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

javac crash when checking imports and a broken class is present

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b17
    • Verification:
      Verified

      Backports

        Description

        Consider these files:
        ---pkg/Missing.java
        broken
        ---Test.java
        import pkg.Missing;
        ---

        Then:
        ---
        $ javac -sourcepath . Test.java ; echo $?
        ./pkg/Missing.java:1: error: reached end of file while parsing
        broken
        ^
        Test.java:1: error: cannot access Missing
        import pkg.Missing;
                  ^
          bad source file: ./pkg/Missing.java
            file does not contain class pkg.Missing
            Please remove or make sure it appears in the correct subdirectory of the sourcepath.
        2 errors
        4
        ---
        ---
        $ javac -sourcepath . -XDdev Test.java
        ./pkg/Missing.java:1: error: reached end of file while parsing
        broken
        ^
        Test.java:1: error: cannot access Missing
        import pkg.Missing;
                  ^
          bad source file: ./pkg/Missing.java
            file does not contain class pkg.Missing
            Please remove or make sure it appears in the correct subdirectory of the sourcepath.
        2 errors
        An exception has occurred in the compiler (11-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 and the following diagnostic in your report. Thank you.
        java.lang.NullPointerException
                at jdk.compiler/com.sun.tools.javac.comp.Check.isCanonical(Check.java:3565)
                at jdk.compiler/com.sun.tools.javac.comp.Check.checkCanonical(Check.java:3557)
                at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.doImport(TypeEnter.java:425)
                at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.resolveImports(TypeEnter.java:362)
                at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.access$1700(TypeEnter.java:299)
                at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.lambda$ensureImportsChecked$0(TypeEnter.java:168)
                at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.finishImports(TypeEnter.java:220)
                at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.ensureImportsChecked(TypeEnter.java:168)
                at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:600)
                at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:560)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1061)
                at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:932)
                at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:306)
                at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
                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

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: