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

TypeElement.getSuperclass crashes for a record TypeElement when j.l.Record is not available

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b15

      Description

      Consider a TypeElement for a record when the j.l.Record is unavailable for any reason. Calling TypeElement.getSuperclass() leads to a NPE like:
      ---
      java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.tree.JCTree.accept(com.sun.tools.javac.tree.JCTree$Visitor)" because "tree" is null
      "MainThread"
      at com.sun.tools.javac.comp.TypeEnter$AbstractHeaderPhase$Synthesizer.visit(TypeEnter.java:595)
      at com.sun.tools.javac.comp.TypeEnter$AbstractHeaderPhase$1.getModelType(TypeEnter.java:575)
      at com.sun.tools.javac.code.Symbol$ClassSymbol.getSuperclass(Symbol.java:1443)
      at com.sun.tools.javac.code.Symbol$ClassSymbol.getSuperclass(Symbol.java:1257)
      at RecordsErrorRecovery.getSuperclass(RecordsErrorRecovery.java:73)
      ---

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jlahoda Jan Lahoda
              Reporter:
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: