-
Bug
-
Resolution: Duplicate
-
P4
-
6
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)
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
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 :
The error seems to say that wildcard use is incompatible with an identically-declared method result.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error
ACTUAL -
Final1.java:5: incompatible types
found : Agg<J,K,capture of ? extends Pair<J,K>>
required: Agg<J,K,? extends Pair<J,K>>
Agg<J,K, ? extends Pair<J,K>> aggs = haver.getAgg();
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Collection;
abstract class Test<J, K> {
void have(Haver<J,K> haver) {
Agg<J,K, ? extends Pair<J,K>> aggs = haver.getAgg();
Collection<? extends Pair<J,K>> pairs = aggs.getPairs();
for(final Pair<J,K> pair : pairs)
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 ----------
Note that code is processed without error on a colleague's Eclipse, Nov. 10 integrated build Windows 2000
###@###.### 2004-12-13 23:18:01 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)
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
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 :
The error seems to say that wildcard use is incompatible with an identically-declared method result.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error
ACTUAL -
Final1.java:5: incompatible types
found : Agg<J,K,capture of ? extends Pair<J,K>>
required: Agg<J,K,? extends Pair<J,K>>
Agg<J,K, ? extends Pair<J,K>> aggs = haver.getAgg();
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Collection;
abstract class Test<J, K> {
void have(Haver<J,K> haver) {
Agg<J,K, ? extends Pair<J,K>> aggs = haver.getAgg();
Collection<? extends Pair<J,K>> pairs = aggs.getPairs();
for(final Pair<J,K> pair : pairs)
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 ----------
Note that code is processed without error on a colleague's Eclipse, Nov. 10 integrated build Windows 2000
###@###.### 2004-12-13 23:18:01 GMT
- duplicates
-
JDK-6209736 Javac seems to confuse type variable names
-
- Closed
-
-
JDK-5034571 Wildcard capture must use the bounds of the formal
-
- Closed
-