JDK-6207912 : Wildcard capture reported incompatible with wildcard use
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-12-13
  • Updated: 2010-04-02
  • Resolved: 2005-12-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Duplicate :  
Duplicate :  
Description
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

Comments
EVALUATION This is either a problem in the implementation of wildcard capture or computation of formal bounds on wildcards (or both). ###@###.### 2004-12-14 02:40:12 GMT
14-12-2004