Hi

I need to run the cleaner of a direct NIO byte buffer by using the reflection 
API to access to non public APIs as I successfully did with previous versions 
of Java. The cleaner is in the class "Cleaner" in the package 
"jdk.internal.ref" in the module "java.base" and my own module is unnamed. 
Then, I tried to pass "--add-exports java.base/jdk.internal.ref=ALL-UNNAMED" to 
the command "java" but I get the following exception:
[gouessej@localhost test-classes]$ ~/Téléchargements/jdk-9/bin/java -cp 
../classes:../test-classes engine/misc/TestDeallocationHelper --add-exports 
java.base/jdk.internal.ref=ALL-UNNAMED 
août 06, 2016 11:25:22 AM 
engine.misc.DeallocationHelper$OracleSunOpenJdkDeallocator run
AVERTISSEMENT: The deallocation of a direct NIO buffer has failed
java.lang.IllegalAccessException: class 
engine.misc.DeallocationHelper$OracleSunOpenJdkDeallocator cannot access class 
jdk.internal.ref.Cleaner (in module java.base) because module java.base does 
not export jdk.internal.ref to unnamed module @464bee09
at 
jdk.internal.reflect.Reflection.throwIllegalAccessException(java.base@9-ea/Reflection.java:405)
at 
jdk.internal.reflect.Reflection.throwIllegalAccessException(java.base@9-ea/Reflection.java:396)
at 
jdk.internal.reflect.Reflection.ensureMemberAccess(java.base@9-ea/Reflection.java:98)
at 
java.lang.reflect.AccessibleObject.slowCheckMemberAccess(java.base@9-ea/AccessibleObject.java:355)
at 
java.lang.reflect.AccessibleObject.checkAccess(java.base@9-ea/AccessibleObject.java:347)
at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:527)
at 
engine.misc.DeallocationHelper$OracleSunOpenJdkDeallocator.run(DeallocationHelper.java:109)
at engine.misc.DeallocationHelper.deallocate(DeallocationHelper.java:729)
at engine.misc.TestDeallocationHelper.main(TestDeallocationHelper.java:137)

What am I missing?

Reply via email to