Add jdk.internal.reflect to ExternalAPIWhitelist for Java 9 compatibility (fixes #3106) #3107
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.
Contains
Adds the
jdk.internal.reflect
to the API whitelist for modules to fix the compatibility issue with Java 9 as reported in #3106. I tested with OpenJDK 9 and appears to work correctly.As you can see in the crash log reported by @dariost in the issue, right before throwing the exception there is a line which says
02:40:14.218 [main] ERROR o.t.module.sandbox.ModuleClassLoader - Denied access to class (not allowed with this module's permissions): jdk.internal.reflect.ConstructorAccessorImpl
. So in my understanding there are modules which use code that relies on reflection, and the new JVM implementation uses additional internal classes for reflection and the custom filtering classloader denies access to said classes from sandboxed modules. So "unlocking" the mentioned package seems to solve the issue.How to test
Run the game with a Java 9 JVM and create a new game with Core Gameplay or Josharias Survival gameplay model and start it. On this branch should load and work correctly without crashing as in the current
master
/develop
versions.Outstanding before merging
It probably is a good idea to find some documentation about the added package to make sure it does not
introduce security issues, i.e. it does not allow modules to break out from the sandbox to access filesystem or doing anything the shouldn't do. Looks like this isn't an easy task since these are probably classes meant for internal use by other JDK parts only, in fact I couldn't find the javadoc (and in fact we aren't using them directly; it's reached through
ReflectionReflectFactory
which uses thejava.lang.reflect.Constructor
class, which in turn, in the new Java 9 implementations, appears to use the discussed package).