Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8167525

update jdk tests to remove @compile --add-modules workaround

    Details

    • Resolved In Build:
      b161

      Backports

        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

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  amlu Amy Lu
                  Reporter:
                  mchung Mandy Chung
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: