Java 9 build 118 is hiding some documented & public classes from unnamed module

Uwe Schindler uschindler at apache.org
Mon May 16 14:28:15 UTC 2016


Hi,

the Lucene team installed JDK9 build 118 today and this failed our build during some checks. The reason is that some classes are missing from the unnamed module (standard Java 8 classpath-only application). Just try this test:

public class Test {
  public static void main(String... args) throws Exception {
    Class.forName("javax.xml.bind.DatatypeConverter"); 
  }
}

$ javac Test.java
$ java Test
Exception in thread "main" java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
        at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base at 9-ea/BuiltinClassLoader.java:366)
        at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base at 9-ea/ClassLoaders.java:184)
        at java.lang.ClassLoader.loadClass(java.base at 9-ea/ClassLoader.java:419)
        at java.lang.Class.forName0(java.base at 9-ea/Native Method)
        at java.lang.Class.forName(java.base at 9-ea/Class.java:294)
        at Test.main(Test.java:3)

$ java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+118)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+118, mixed mode)

This works with build 116 and Java 8.

This is not the only class that’s missing at runtime, there are more: I do not have the complete list, but our checks using the forbiddenapis Ant/Maven/Gradle plugin fails to load classes around JAXB/XML (javax.xml.bind.*, javax.jws.*) and CORBA (org.omg.CORBA.*), but also "javax.activation.ActivationDataFlavor". But there may be more packages missing.

It looks like some module exports are missing because the classes are all listed on the JDK docs: http://download.java.net/java/jdk9/118/docs/api/index.html
I'd suggest to add a check in the packaging that validates that all classes also visible in the Javadocs are visible at runtime from applications not using the module system.

Should I open bug report or can we shortcut this through the mailing list?

Greetings from the Lucene team,
Uwe

-----
Uwe Schindler
uschindler at apache.org 
ASF Member, Apache Lucene PMC / Committer
Bremen, Germany
http://lucene.apache.org/




More information about the jigsaw-dev mailing list