Open assofohdz opened 5 years ago
How can we reproduce the warning?
I was running latest stable jme at the time, but with java 11. After changing to java 8 I did not experience the issue any more.
This is no real wonder, as the ReflectiveAllocator works by using questionable hacks. If you are actually worried about it, you could use a different one, eg the lwjgl based one.
This issue recently started showing up in the Travis openjdk11 build. Here is the context:
> Task :jme3-core:processTestResources
> Task :jme3-core:testClasses
> Task :jme3-core:test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/home/travis/build/jMonkeyEngine/jmonkeyengine/jme3-core/build/classes/java/main/) to method sun.nio.ch.DirectBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
We could make PrimitiveAllocator
the default instead of ReflectionAllocator
. One drawback is that PrimitiveAllocator
can't actually destroy direct buffers, so there could be other runtime warnings (to System.err
) and a greater likelihood of running out of buffers.
@tlf30 I know you use Java 11. Have you encountered this issue?
Yes, all of my apps have these errors all over with jme. It is not an issue right now, just a warning. I has to do with the fact that future versions of Java will deny reflection access if a module does not explicitly give it permission. This can be fixed by creating a module definition for jme. It is something that has been on my Todo list for a while.
Yes, JME (especially networking but other places, too) will need reflective access.
Regarding sun.nio.ch.DirectBuffer.cleaner()
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/home/travis/build/jMonkeyEngine/jmonkeyengine/jme3-core/build/classes/java/main/) to method sun.nio.ch.DirectBuffer.cleaner()
there is an alternative way for Java 9+: https://bugs.openjdk.java.net/browse/JDK-8171377
https://github.com/diffplug/matfilerw/issues/16#issuecomment-434623867
Edit: And https://github.com/rrd4j/rrd4j/commit/4b791a7ac03c26ff159f97fa0716c0d28aa15a45
When running my game on my work station (not when running it on my laptop), I get the follow error: