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

javac crash on unattributed piece of AST

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 24
    • 24
    • tools
    • None
    • b06

    Description

      Consider the following sources:
      ---B.java
      package p;

      public class B {
          public interface I {}
      }
      ---
      ---Test.java
      import p.B.I;
      ---

      Then compile and remove the 'I' nested interface:
      ---
      $ javac -d out B.java
      $ rm out/p/B\$I.class
      $ javac -classpath out -XDdev Test.java
      Test.java:1: error: cannot access I
      import p.B.I;
                ^
        class file for p.B$I not found
      1 error
      An exception has occurred in the compiler (24-internal). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://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: Cannot read field "owner" because "s.sym" is null
              at jdk.compiler/com.sun.tools.javac.comp.Check.isCanonical(Check.java:4264)
              at jdk.compiler/com.sun.tools.javac.comp.Check.checkCanonical(Check.java:4256)
              at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.doImport(TypeEnter.java:466)
              at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.handleImports(TypeEnter.java:416)
              at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.resolveImports(TypeEnter.java:389)
              at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.lambda$ensureImportsChecked$0(TypeEnter.java:165)
              at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.finishImports(TypeEnter.java:217)
              at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.ensureImportsChecked(TypeEnter.java:165)
              at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:650)
              at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:600)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1077)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:948)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
      printing javac parameters to: /tmp/javac.20240701_092709.args
      ---

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: