-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
5.0
-
generic
-
generic
import java.util.List;
class Foo {}
class Bar extends Foo {}
interface FooList<T extends Foo> extends List<T> {}
class Test {
<T extends FooList<? super Bar>> void m(T t) {
Foo f = t.get(0);
}
}
The program below doesn't compile:
$ javac Test.java
Test.java:9: incompatible types
found : java.lang.Object
required: Foo
Foo f = t.get(0);
^
1 error
class Foo {}
class Bar extends Foo {}
interface FooList<T extends Foo> extends List<T> {}
class Test {
<T extends FooList<? super Bar>> void m(T t) {
Foo f = t.get(0);
}
}
The program below doesn't compile:
$ javac Test.java
Test.java:9: incompatible types
found : java.lang.Object
required: Foo
Foo f = t.get(0);
^
1 error
- duplicates
-
JDK-6227936 Wrong type of inherited method using specialized type parameter
-
- Closed
-