Illegal reflective access by com.jme3.util.ReflectionAllocator

openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment 18.3 (build 10.0.2+13)
OpenJDK 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

Aug 02, 2018 8:31:52 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.2-stable
 * Branch: HEAD
 * Git Hash: f85624a
 * Build Date: 2018-01-21

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Users/oualid/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.2.1-stable/e291222f9a6d07e52daf99e8f3b9385ddabaf1ca/jme3-core-3.2.1-stable.jar) 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

the warning has no effects right now.

link to com.jme3.util.ReflectionAllocator

Do you have any more information to go by? Is there any specific action that causes this? Is it possible to create a test case?

Java10 is starting to clamp down on reflective access to private methods.

…If Java gave us a legitimate way to free memory then we wouldn’t need it in this case. Of course, other parts of the engine (like SpiderMonkey serialization) still would.

Someone who cares more than I do right now should look into if there is a switch that can turn off this check.

no test case needed but if you need one

public class ServerCase extends SimpleApplication {


    @Override
    public void simpleInitApp() {
        try {
            Server server = Network.createServer(8080);
            server.start();
            System.out.println("server started :)");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public static void main(String[] args) {
        ServerCase serverCase = new ServerCase();
        serverCase.start(JmeContext.Type.Headless);
    }
}

You shouldn’t have to start a server… any JME app should trigger this, I think.

yep, probably it just happened that I got it when I start a server :wink:

I’m more concerned about the day a switch isn’t enough anymore and we’re stuck on java <10 or something.
Since it’s currently only a warning, it’s fine as it is I guess, but we should have a workaround at hand sooner or later

Tons of reflection code all over the world will break if there is not an exception to this. There will always be some way to disable it on desktop, I guess.

you can use LWJGL3 instead of LWJGL2 module which supports java 10 :wink:

haha I never used LWJGL2, the problem is in jME

jME uses LWJGL2/LWJGL3/JOGL as different back-ends.

and… anyway what LWJGL or JOGL got to do with this. the class that causes this warning don’t use anything besides Java lang and nio packages, so LWJGL got nothing to do with this.

no, LWJGL3 provides another implementation of BufferAllocator which doesn’t use Reflection API. You need to change your dependencies to use lwjgl3 as back-end.