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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • 26
    • 25, 26
    • tools
    • None

      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)
      ```

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

              Created:
              Updated: