Elements.getFileObjectOf fails with a NullPointerException when an erroneous Element is passed in

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 26
    • Affects Version/s: 25, 26
    • Component/s: tools
    • None
    • b15

      When an erroneous element is passed to Elements.getFileObjectOf, there's a NPE:
      ```
      Caused by: java.lang.NullPointerException: Cannot read field "classfile" because the return value of "com.sun.tools.javac.code.Symbol.enclClass()" is null
      at jdk.compiler/com.sun.tools.javac.model.JavacElements.getFileObjectOf(JavacElements.java:803)
      at TestFileObjectOf$PrintFiles.handleDeclaration(TestFileObjectOf.java:329)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2718)
      ```

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

              Created:
              Updated:
              Resolved: