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

-XDfind=diamond crashes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 14
    • tools
    • None
    • b13

      Consider this source code:
      ---
      public class AnalyzerNotQuiteSpeculative {
          private void test() {
              Subclass1 c1 = null;
              Subclass2 c2 = null;
              Base b = null;
              
              t(new C<Base>(c1).set(c2));
              t(new C<Base>(b).set(c2));
          }

          public static class Base {}
          public static class Subclass1 extends Base {}
          public static class Subclass2 extends Base {}
          public class C<T extends Base> {
              public C(T t) {}
              public C<T> set(T t) { return this; }
          }
          <T extends Base> void t(C<? extends Base> l) {}
      }
      ---

      Compiling this with -XDfind=diamond, javac crashes with:
      ---
      $ javac -XDfind=diamond /tmp/AnalyzerNotQuiteSpeculative.java
      An exception has occurred in the compiler (14-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, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.AssertionError: Analyzer error when processing: t(new C<Base>(c1).set(c2));
              at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)
              at jdk.compiler/com.sun.tools.javac.comp.Analyzer.doAnalysis(Analyzer.java:568)
              at jdk.compiler/com.sun.tools.javac.comp.Analyzer$2.flush(Analyzer.java:539)
              at jdk.compiler/com.sun.tools.javac.comp.Analyzer.flush(Analyzer.java:576)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1412)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1380)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:972)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:318)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
      ---

      Originally reported here:
      https://issues.apache.org/jira/browse/NETBEANS-2956

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

              Created:
              Updated:
              Resolved: