JDK-8167525 : update jdk tests to remove @compile --add-modules workaround
  • Type: Bug
  • Component: core-libs
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-10-11
  • Updated: 2017-03-16
  • Resolved: 2017-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 9
10Fixed 9 b161Fixed
Related Reports
Relates :  
Description
$ cat Test.java
public class Test {
    public static void main(String[] args) throws Throwable {
        sun.tools.jcmd.JCmd.main(args);
    }
}

$ javac --add-exports jdk.jcmd/sun.tools.jcmd=ALL-UNNAMED Test.java

jdk.jcmd is not in the default root set.    --add-modules jdk.jcmd should be required.  If missing, a warning is emitted at runtime.  Error when it attempts to access the internal type at runtime.

$ java --add-exports jdk.jcmd/sun.tools.jcmd=ALL-UNNAMED Test

WARNING: Unknown module: jdk.jcmd
Exception in thread "main" java.lang.NoClassDefFoundError: sun/tools/jcmd/JCmd
	at Test.main(Test.java:9)
Caused by: java.lang.ClassNotFoundException: sun.tools.jcmd.JCmd
	at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-internal/BuiltinClassLoader.java:366)
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-internal/ClassLoaders.java:185)
	at java.lang.ClassLoader.loadClass(java.base@9-internal/ClassLoader.java:424)
	... 1 more

Comments
RFR: http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-March/046629.html
08-03-2017

Changes like JDK-8156579 ( added * @run main/othervm --add-modules=java.activation,java.transaction,java.corba,java.xml.bind TestConstructorFinder) will also be reverted.
08-03-2017

Note that there's one test problem listed due to this issue: sun/nio/cs/OLD/TestIBMDB.java 8167525 generic-all
16-12-2016

This issue has been resolved in http://hg.openjdk.java.net/jdk9/dev/langtools/rev/80b576bd3631. This bug is blocked by CODETOOLS-7901761. Since this javac bug has been fixed in jdk9/dev, we workaround the jtreg bug by adding @compile --add-modules into the tests. This issue is kept open and use to remove the workaround when CODETOOLS-7901761 is resolved.
04-11-2016