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

javac crashes when checking equals and hashCode in unresolvable anonymous class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 15
    • None
    • tools
    • None
    • b20

    Description

      Consider code like:
      ---
      public class InvalidAnonymous {
          private void t() {
              new Undefined() {};
          }
      }
      ---

      And compile with -Xlint:overrides:
      $ javac -XDdev -Xlint:overrides InvalidAnonymous.java
      InvalidAnonymous.java:3: error: cannot find symbol
              new Undefined() {};
                  ^
        symbol: class Undefined
        location: class InvalidAnonymous
      1 error
      An exception has occurred in the compiler (15-internal). 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, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.NullPointerException
              at jdk.compiler/com.sun.tools.javac.comp.Check.checkClassOverrideEqualsAndHash(Check.java:2148)
              at jdk.compiler/com.sun.tools.javac.comp.Check.checkClassOverrideEqualsAndHashIfNeeded(Check.java:2138)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5048)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4974)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:965)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:786)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitAnonymousClassDefinition(Attr.java:2774)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:2665)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1791)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:716)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:2092)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1523)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:755)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1414)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1204)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:884)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5154)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5045)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4974)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4919)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1348)
              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:316)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
      printing javac parameters to: /home/jlahoda/src/jdk/jdk/javac.20200415_092643.args

      Attachments

        Issue Links

          Activity

            People

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: