FULL PRODUCT VERSION :
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b12)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b12, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux [machine name] 2.6.8.1-12mdk #1 Fri Oct 1 12:53:41 CEST 2004 i686 AMD Athlon(tm) XP 2400+ unknown GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Javac seems to confuse type variable names
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error
ACTUAL -
Final2.java:5: incompatible types
found : Pair<C,D>
required: Pair<J,K>
for(final Pair<J,K> pair : haver.getAgg().getPairs())
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Collection;
abstract class Anon<J, K> {
void have(Haver<J,K> haver) {
for(final Pair<J,K> pair : haver.getAgg().getPairs())
System.out.println(pair);
}
}
interface Pair<A,B> {
A getA(); B getB();
}
interface Agg<C,D, E extends Pair<C,D>> {
Collection<E> getPairs();
}
interface Haver<F,G> {
Agg<F,G, ? extends Pair<F,G>> getAgg();
}
---------- END SOURCE ----------
###@###.### 2004-12-16 21:25:57 GMT
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b12)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b12, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux [machine name] 2.6.8.1-12mdk #1 Fri Oct 1 12:53:41 CEST 2004 i686 AMD Athlon(tm) XP 2400+ unknown GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Javac seems to confuse type variable names
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error
ACTUAL -
Final2.java:5: incompatible types
found : Pair<C,D>
required: Pair<J,K>
for(final Pair<J,K> pair : haver.getAgg().getPairs())
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Collection;
abstract class Anon<J, K> {
void have(Haver<J,K> haver) {
for(final Pair<J,K> pair : haver.getAgg().getPairs())
System.out.println(pair);
}
}
interface Pair<A,B> {
A getA(); B getB();
}
interface Agg<C,D, E extends Pair<C,D>> {
Collection<E> getPairs();
}
interface Haver<F,G> {
Agg<F,G, ? extends Pair<F,G>> getAgg();
}
---------- END SOURCE ----------
###@###.### 2004-12-16 21:25:57 GMT
- duplicates
-
JDK-6207912 Wildcard capture reported incompatible with wildcard use
-
- Closed
-