-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b25
-
generic
-
generic
-
Not verified
Description:
The following code fails during compilation with "internal error".
<code>
public class TypeInferenceTest<S>{
public TypeInferenceTest() {
this(1,1); //Throws internal error; cannot instanatiate ...
//<Number>this(1,1); //Cannot find symbol
// <Integer>this(1); //Cannot find symbol
// this(1); //Cannot find symbol
}
public <T extends S> TypeInferenceTest(T a, T b) {
//.....
}
public <T extends S> TypeInferenceTest(T a) {
//....
}
<T extends S> void met1(T a,T b){
met2 (1,1);//Throws internal error; cannot instanatiate ...
new TypeInferenceTest<Number> ().met2 (1,1); //Compiles fine -- Type Inference works
// met2(1); // Cannot find symbol
}
<T extends S> void met2(T a,T b){
//..
}
<T extends S> void met2(T a){
//...
}
}
</code>
Compilation result is :
<output>
TypeInferenceTest.java:5: internal error; cannot instantiate <T>TypeInferenceTest(T,T) at TypeInferenceTest<S> to ()
this(1,1); //Throws internal error; cannot instanatiate ...
^
TypeInferenceTest.java:18: internal error; cannot instantiate <T>met2(T,T) at TypeInferenceTest<S> to (int,int)
Integer i = met2 (1,1);//Throws internal error; cannot instanatiate ...
^
2 errors
</output>
Tried in :
<version>
java version "1.7.0-internal"
Java(TM) SE Runtime Environment (build 1.7.0-internal-jprtadm_26_Sep_2007_03_43-b00)
Java HotSpot(TM) Server VM (build 11.0-b06, mixed mode)
uname -a
SunOS bonsai 5.11 snv_49 i86pc i386 i86pc
The following code fails during compilation with "internal error".
<code>
public class TypeInferenceTest<S>{
public TypeInferenceTest() {
this(1,1); //Throws internal error; cannot instanatiate ...
//<Number>this(1,1); //Cannot find symbol
// <Integer>this(1); //Cannot find symbol
// this(1); //Cannot find symbol
}
public <T extends S> TypeInferenceTest(T a, T b) {
//.....
}
public <T extends S> TypeInferenceTest(T a) {
//....
}
<T extends S> void met1(T a,T b){
met2 (1,1);//Throws internal error; cannot instanatiate ...
new TypeInferenceTest<Number> ().met2 (1,1); //Compiles fine -- Type Inference works
// met2(1); // Cannot find symbol
}
<T extends S> void met2(T a,T b){
//..
}
<T extends S> void met2(T a){
//...
}
}
</code>
Compilation result is :
<output>
TypeInferenceTest.java:5: internal error; cannot instantiate <T>TypeInferenceTest(T,T) at TypeInferenceTest<S> to ()
this(1,1); //Throws internal error; cannot instanatiate ...
^
TypeInferenceTest.java:18: internal error; cannot instantiate <T>met2(T,T) at TypeInferenceTest<S> to (int,int)
Integer i = met2 (1,1);//Throws internal error; cannot instanatiate ...
^
2 errors
</output>
Tried in :
<version>
java version "1.7.0-internal"
Java(TM) SE Runtime Environment (build 1.7.0-internal-jprtadm_26_Sep_2007_03_43-b00)
Java HotSpot(TM) Server VM (build 11.0-b06, mixed mode)
uname -a
SunOS bonsai 5.11 snv_49 i86pc i386 i86pc
- relates to
-
JDK-6478540 Receive an internal error from javac when compiling a class
-
- Closed
-