-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6
-
generic
-
generic
Tried on Solaris JDK build 1.6.0-ea-b35.
Please see the following code
<code>
class Pair<X,Y> {
Pair(X x) {
}
<X> void testMethod(X x) {
Pair<String,String> y = new Pair("Hi Pair") {};
}
}
</code>
Output when compiled:
<output>
bash-2.05b$ $b/javac -Xlint Test31.java
Test31.java:5: warning: [unchecked] unchecked call to Pair(X) as a member of the raw type Pair
Pair<String,String> y = new Pair("Hi Pair"){};
^
[unchecked] unchecked call to Pair(X) as a member of the raw type Pair
Test31.java:5: warning: [unchecked] unchecked conversion
found : <anonymous Pair>
required: Pair<java.lang.String,java.lang.String>
Pair<String,String> y = new Pair("Hi Pair"){};
^
3 warnings
</output>
The second warning doesn't have line number and its duplicate of first.
###@###.### 2005-05-09 05:01:22 GMT
###@###.### 2005-05-09 05:38:39 GMT
Please see the following code
<code>
class Pair<X,Y> {
Pair(X x) {
}
<X> void testMethod(X x) {
Pair<String,String> y = new Pair("Hi Pair") {};
}
}
</code>
Output when compiled:
<output>
bash-2.05b$ $b/javac -Xlint Test31.java
Test31.java:5: warning: [unchecked] unchecked call to Pair(X) as a member of the raw type Pair
Pair<String,String> y = new Pair("Hi Pair"){};
^
[unchecked] unchecked call to Pair(X) as a member of the raw type Pair
Test31.java:5: warning: [unchecked] unchecked conversion
found : <anonymous Pair>
required: Pair<java.lang.String,java.lang.String>
Pair<String,String> y = new Pair("Hi Pair"){};
^
3 warnings
</output>
The second warning doesn't have line number and its duplicate of first.
###@###.### 2005-05-09 05:01:22 GMT
###@###.### 2005-05-09 05:38:39 GMT
- duplicates
-
JDK-6264029 Compiler issues two diagnostics for anonymous class, one is sufficient
- Closed
- relates to
-
JDK-6253161 Incorrect position of serial warning in anonymous class
- Closed