Problems building with --release=8

David Lloyd david.lloyd at
Wed Jan 17 17:37:16 UTC 2018

I'm trying to create some MR JARs for projects which use
sun.misc.Unsafe and sun.reflect.ReflectionFactory (both of which exist
in the jdk.unsupported module).  For the Java 8 portion, I'm
attempting to move from using the Java 8 javac to Java 9 (or later).
However I'm running into a problem where these classes are not
available when I compile with --release=8.

As a workaround, I created a JAR which stubbed these two classes and
included it on the compile class path.  However, it seems that they
were actively filtered out or ignored somehow.  Removing --release=8
and just using -source 8 -target 8 allowed the compilation to succeed,
however I want to be sure that no 9+ classes sneak into the 8 part so
I want to use --release=8 if possible.

If jdk.unsupported is allowed for Java 9+, then surely these two
classes should be included in the Java 8 image.

Did I make some kind of mistake or is this a legitimate bug?

More information about the compiler-dev mailing list