On 6/24/18 7:32 AM, Alan Bateman wrote:
This is a corner case that showed up while chasing an issue in another area.

If a tool uses the attach mechanism to start the JMX agent in a running VM that doesn't have the jdk.management.agent module in the boot layer then the module is resolved and defined to the VM in its own module layer.  This results in Java SE and JDK specific modules, such as java.management and jdk.management.agent, being loaded and mapped to the bootstrap class loader but the modules aren't in the boot layer.

In this scenario, using Class::getPackage to get the legacy Package object of a class in one of these modules trips up with an InternalError. This is because the implementation assumes that modules defined to the bootstrap class loader are in boot layer. To fix this, the code that creates Package objects for the packages in modules mapped to the bootstrap class loader needs to use the stack of layers that supports the dynamic loading of the JMX and java agents.

The webrev with the proposed changes, and test, is here:
   http://cr.openjdk.java.net/~alanb/8205533/webrev/index.html

Looks good.

Mandy

Reply via email to