Details
-
Bug
-
Resolution: Fixed
-
P2
-
5.0
-
b51
-
generic
-
generic
Description
The following code compiled without any problems on b48.
public class CI {
Comparable<?> x;
void put(Comparable<?> x) { this.x = x; }
Comparable<?> get() { return x; }
void test() {
CI ci = new CI();
ci.put(new Integer(3));
Integer x = (Integer)ci.get();
}
}
On b49 it generates the following error message:
CI.java:15: inconvertible types
found : java.lang.Comparable<capture of ?>
required: java.lang.Integer
Integer x = (Integer)ci.get();
^
Unless I'm mistaken, this code is legal and should compile.
-- ###@###.### 2004/5/2
public class CI {
Comparable<?> x;
void put(Comparable<?> x) { this.x = x; }
Comparable<?> get() { return x; }
void test() {
CI ci = new CI();
ci.put(new Integer(3));
Integer x = (Integer)ci.get();
}
}
On b49 it generates the following error message:
CI.java:15: inconvertible types
found : java.lang.Comparable<capture of ?>
required: java.lang.Integer
Integer x = (Integer)ci.get();
^
Unless I'm mistaken, this code is legal and should compile.
-- ###@###.### 2004/5/2