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

NPE when loading a preview classfile from a future Java version

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 12.0.1
    • tools
    • b24
    • x86
    • windows_10

      A NullPointerException is raised when compiling a module via {{javac}} (12) using {{--module-source-path}} that was already compiled by a newer version (13) of {{javac}}.

      Tried to reproduce it with {{javac}} 13 and 14 -- those version don't seem to be affected.

      {{
      Running javac -d bin\realm\test\jigsaw\classes --enable-preview --release 12 --module-path bin\realm\test\modules;bin\realm\main\modules;lib --module-source-path src\modules\*\test\java --module-version 2-ea --module it

      warning: bin\realm\test\jigsaw\classes\it\module-info.class: major version 57 is newer than 56, the highest major version supported by this compiler.
        It is recommended that the compiler be upgraded.
      1 warning

      An exception has occurred in the compiler (12). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.

      java.lang.NullPointerException
              at jdk.compiler/com.sun.tools.javac.code.Preview.warnPreview(Preview.java:150)
              at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2795)
              at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2817)
              at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:359)
              at jdk.compiler/com.sun.tools.javac.code.ModuleFinder$1.complete(ModuleFinder.java:378)
              at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
              at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1326)
              at jdk.compiler/com.sun.tools.javac.comp.Modules$1.complete(Modules.java:641)
              at jdk.compiler/com.sun.tools.javac.code.Symtab.lambda$enterModule$9(Symtab.java:795)
              at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
              at jdk.compiler/com.sun.tools.javac.comp.Modules.computeTransitiveClosure(Modules.java:1390)
              at jdk.compiler/com.sun.tools.javac.comp.Modules.setupAllModules(Modules.java:1318)
              at jdk.compiler/com.sun.tools.javac.comp.Modules.lambda$initModules$0(Modules.java:237)
              at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:269)
              at jdk.compiler/com.sun.tools.javac.comp.Modules.initModules(Modules.java:233)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.initModules(JavaCompiler.java:1045)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:939)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
              at jdk.compiler/com.sun.tools.javac.main.JavacToolProvider.run(JavacToolProvider.java:46)
      }}

            jlahoda Jan Lahoda
            cstein Christian Stein
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: