-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
5.0
-
x86
-
windows_xp
###@###.### 2004-05-12
J2SE Version (please include all output from java -version flag):
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b50)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b50, mixed mode, sharing)
Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
no, works fine with build 48
Operating System Configuration Information (be specific):
WinXP
Hardware Configuration Information (be specific):
Dell Optiplex
Bug Description:
Before build 50, my code compiled, Now it doesn't; get the following
compiler error (with extra white-space padding):
[javac] C:\devel\GenericTest.java:11: incompatible types
[javac] found : java.util.Iterator<GenericTest.Foo<capture of ? extends java.lang.String,capture of ? extends java.awt.Color>>
[javac] required: java.util.Iterator<GenericTest.Foo< ? extends java.lang.String, ? extends java.awt.Color>>
[javac] return Collections.singleton(symbol).iterator();
Steps to Reproduce (be specific):
Compile this code:
import java.util.Iterator;
import java.util.Collections;
import java.awt.Color;
public class GenericTest
{
Foo<? extends String, ? extends Color> symbol;
public Iterator<Foo<? extends String, ? extends Color>> iterator()
{
return Collections.singleton(symbol).iterator();
}
public class Foo<A, B> {
}
}
Casting the result of Collections.singleton doesn't seem to work,
and nore does casting symbol.
- duplicates
-
JDK-4931824 new rewrite rules versus wildcards in ConcurrentHashMap
- Closed