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

NullPointerException during compiling JAVA 15 module with JAVA 14 JAVAFX

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_2012

      Description

      A DESCRIPTION OF THE PROBLEM :
      In this case, the core modules are built with Java 15 (build 15-ea+34-1554), bytecode compatibility 15 (Bytecode version 59) and enabled preview feature . The code is actually "Java 14+ Preview-Feature" compatible (at least bytecode version 58.65535).
      However, the JavaFX GUI requires Java 14 (build 14.0.2+12-46), so it cannot handle the 15-byte code of the core classes: major version 59 is newer than 58, the highest major version supported by this compiler.

      When compiling the GUI sources and modules, which contains references to the core modules (Bytecode version 59), with Java 14 an exception occurred.
      [javac] java.lang.NullPointerException
      [javac] at jdk.compiler/com.sun.tools.javac.code.Preview.warnPreview(Preview.java:146)
      [javac] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2559)
      [javac] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2583)
      [javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:362)
      [javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:292)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:670)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1383)
      [javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.loadClass(ClassFinder.java:435)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:2007)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInPackageInternal(Resolve.java:2402)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:2390)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:4184)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4069)
      [javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2276)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:729)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:722)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.attribImportType(TypeEnter.java:444)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.doImport(TypeEnter.java:427)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.resolveImports(TypeEnter.java:367)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.runPhase(TypeEnter.java:324)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:285)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:254)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:201)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:670)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1383)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:584)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:561)
      [javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1071)
      [javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
      [javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:316)
      [javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
      [javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      [javac] at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javac
      -d <destination directory for class files>
      -classpath <cp>
      -sourcepath <source code path JAVA 14 compatible>
      -g
      --enable-preview
      --release 14

      ACTUAL -
      [javac] java.lang.NullPointerException
      [javac] at jdk.compiler/com.sun.tools.javac.code.Preview.warnPreview(Preview.java:146)
      [javac] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2559)
      [javac] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2583)
      [javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:362)
      [javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:292)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:670)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1383)
      [javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.loadClass(ClassFinder.java:435)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:2007)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInPackageInternal(Resolve.java:2402)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:2390)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:4184)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4069)
      [javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2276)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:729)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:722)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.attribImportType(TypeEnter.java:444)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.doImport(TypeEnter.java:427)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.resolveImports(TypeEnter.java:367)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.runPhase(TypeEnter.java:324)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:285)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:254)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:201)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:670)
      [javac] at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1383)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:584)
      [javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:561)
      [javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1071)
      [javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
      [javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:316)
      [javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
      [javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      [javac] at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              adev ANUPAM DEV
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: