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

javac crashes when compiling against a classfile and class bound doesn't exist

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 8u40, 11.0.6
    • Fix Version/s: 16
    • Component/s: tools
    • Labels:

      Description

      To reproduce:

      Create the following 3 source files:

      ////// A.java
      public class A<T extends B<T>> {
          public void foo() {}
      }
       
      ////// B.java
      public class B<T> {}

      ////// C.java
      public class C {
          public static void crashJavaC(A a) {
              a.foo(null);
          }
      }


      $ javac A.java B.java
      $ rm B.java B.class
      $ javac C.java

      An exception has occurred in the compiler (11.0.6). 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.comp.TransTypes.visitSelect(TransTypes.java:811)
                      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2114)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:454)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:622)
                      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:454)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitExec(TransTypes.java:599)
                      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:167)
                      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:454)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitMethodDef(TransTypes.java:489)
                      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:139)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateClass(TransTypes.java:918)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitClassDef(TransTypes.java:475)
                      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
                      at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:454)
                      at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateTopLevelClass(TransTypes.java:942)
                      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1553)
                      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1432)
                      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
                      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.compile(Main.java:57)
                      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)


        Attachments

          Activity

            People

            Assignee:
            vromero Vicente Arturo Romero Zaldivar
            Reporter:
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: