Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] Will Your Project Work When Running on Java 9?

> From: Ed Merks <ed.merks@xxxxxxxxx>

> During testing I also see this stack trace in my Error log:
> java.lang.reflect.InaccessibleObjectException: Unable to make field
> private static volatile
> accessible: module java.base
> does not "opens" to unnamed module @26749efe
>     at java.base/
> java.lang.reflect.AccessibleObject.checkCanSetAccessible(
> 335)
>     at java.base/
> java.lang.reflect.AccessibleObject.checkCanSetAccessible(
> 278)
>     at java.base/java.lang.reflect.Field.checkCanSetAccessible(
>     at java.base/java.lang.reflect.Field.setAccessible(
>     at
> org.eclipse.epp.internal.mpc.core.util.ProxyHelper.getDefaultAuthenticator(
> 116)

> I'm not sure what to make of that, but it suggests that MPC might
> well not function when running on Java 9.

> So in the end, I think there isn't so much to worry about, but
> nevertheless, I strongly encourage each team to test their project's
> readiness so we can all avoid hassles and embarrassment when Java 9
> is finally released.  I've tried to help make that as easy as possible...

> Regards,
> Ed

This is an indication that ProxyHelper is using reflection on some internal types of  Looks like it is to unset itself from the private static field  This likely is happening on shutdown and the ProxyHelper is just trying to clean up the VMs static field.  In the Eclipse Platform case this is not a big deal that it failed because the VM is going to terminate anyway so there is no concern that ProxyHelper could not clean up from the awful static instance in the VM.

I had to work around a similar issue in the Equinox Framework in order to clean up our URLStreamHandlerFactory implementation [1].  I did horrendous things by using the Unsafe class to get around this.  There is a temporary option in Java 9 (--force-open-all-module-packages) that should force all packages from modules in the boot layer to be open for deep reflection on private types.  You can try this option out to see if it works around the issue.  They say this option will be removed in a future release so I don't think it is a viable long term solution.  You could also try using the more specific option --add-opens:

--add-opens java.base/

The commandline help for --add-options does not state that ALL-UNNAMED is a valid target so it may not work, but the similar options --add-reads and --add-exports do state ALL-UNNAMED is a valid target so it may work.  Even this is not a great option because in the future we may try to get the bundles to be loaded as real named modules [2] (note this article is out of date and some of the details have changed significantly).  In that case you would have to be more specific and list the symbolic names of the bundles that need to do deep reflection.



Back to the top