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

Make java.se participate in the preview language feature `requires transitive java.base`

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 25
    • 24
    • tools
    • b03

        After https://github.com/openjdk/jdk/commit/1e97c1c913220b07ff0c1c977cea80bc9436729d, I'm seeing the following regression in a compilation that succeeded on earlier versions:

        ```
        error: cannot access module-info
          bad class file: /modules/java.se/module-info.class
            bad requires flag: ACC_TRANSITIVE (0x0020
            Please remove or make sure it appears in the correct subdirectory of the classpath.
        1 error
        ```

        The change adds a 'requires transitive java.base;` to java.se, and adds a special-case in src/java.base/share/classes/jdk/internal/module/ModuleInfo.java for the validation of 'requires transitive'.

        There is no special case for java.se in src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java for that implementation of 'requires transitive' logic, should there be?

        A simple, contrived repro is to compile a different version of java.base:

        === ./module-info.java ===
        module java.base {
          exports java.lang;
        }
        === ./java/lang/Object.java ===
        package java.lang;
        public class Object {}
        === ./T.java ===
        class T {
          java.lang.instrument.ClassFileTransformer t;
        }

        javac --patch-module=java.base=. module-info.java java/lang/Object.java
        jar cvf lib.jar module-info.class java/lang/Object.class
        javac T.java --patch-module=java.base=lib.jar
        error: cannot access module-info
          bad class file: /modules/java.se/module-info.class
            bad requires flag: ACC_TRANSITIVE (0x0020
            Please remove or make sure it appears in the correct subdirectory of the classpath.
        1 error

              jlahoda Jan Lahoda
              cushon Liam Miller-Cushon
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: