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

internal error; cannot instantiate Foo

XMLWordPrintable

    • b06
    • x86
    • linux
    • Verified

        FULL PRODUCT VERSION :
        >/data/tora/java-versions/jdk1.7.0/bin/java -version
        java version "1.7.0"
        Java(TM) SE Runtime Environment (build 1.7.0-b147)
        Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        >uname -a
        Linux agile.doc.ic.ac.uk 2.6.38.2 #3 SMP Wed Mar 30 14:19:08 BST 2011 x86_64 GNU/Linux


        A DESCRIPTION OF THE PROBLEM :
        A cast of null to an unknown symbol (BitSet in Bar below is not imported) can cause the compiler to reach an internal error during generics resolution of the file Foo.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        >cat Foo.java
        import java.util.Comparator;
        public class Foo {
            public Foo (Comparator<Object> list, boolean ret) {
            }
        }

        >cat Bar.java
        public class Bar {
            public static void main(String[] args) {
                final Foo f = new Foo(null, (BitSet) null );
            }
        }

        > javac Foo.java Bar.java

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Not an internal error.
        ACTUAL -
        >/data/tora/java-versions/jdk1.7.0/bin/javac Foo.java Bar.java
        Bar.java:3: error: cannot find symbol
                final Foo f = new Foo(null, (BitSet) null );
                                             ^
          symbol: class BitSet
          location: class Bar
        Bar.java:3: error: internal error; cannot instantiate Foo(Comparator<Object>,boolean) at Foo to ()
                final Foo f = new Foo(null, (BitSet) null );
                              ^
        2 errors


        REPRODUCIBILITY :
        This bug can be reproduced always.

              mcimadamore Maurizio Cimadamore
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: