[GR-71065] Introduce ResolvedJavaModule and ResolvedJavaPackage #12555
+678
−102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For Project Terminus (#12236), we need to move from core reflection to JVMCI reflection. This pull request introduces JVMCI analogs for Java modules and packages to replace the direct use of
java.lang.Module,java.lang.ModuleLayer, andjava.lang.Package.Key Changes:
ResolvedJavaModule,ResolvedJavaModuleLayer, andResolvedJavaPackage. Their current implementation is just a wrapper around the JDK classes. Once the surface of the interfaces is complete, we want to add an independent implementation, potentially in JVMCI.HostModuleUtilfor allowing hosted code (e.g., an internal Feature) to read a runtime module. This is only needed until we fully transitioned to Terminus, but until then, we want to mark such usages of the module system. See https://ol-bitbucket.us.oracle.com/projects/G/repos/graal/pull-requests/22534/overview?commentId=1330454 for discussion.Refactoring:
JVMCIReflectionUtilFallbackfor implementing features ofJVMCIReflectionUtilthat still need core reflection due to missing features in JVMCI. Currently this is mainly for module/package lookups and origin/location queries. Having this separate allows us to keepJVMCIReflectionUtilclean andJVMCIReflectionUtilFallbackserves as a list of action items we need to fix eventually.Migrations:
ModuleandPackagein features to use the new alternatives. (Mainly for distilling an initial list of methods that we need to support.)ResolvedJavaModuleLayer.boot().findModule(), replacing the direct use ofModuleLayer.boot().findModule(). Usually used to enable feature code based on module availability.HostModuleUtil.addReads()instead ofModule.addReads().Additional Notes:
ResolvedJavaModule,HostModuleUtil, etc.).