-
Bug
-
Resolution: Won't Fix
-
P4
-
6
-
generic
-
generic
Tried on Linux JDK build 1.6.0-auto-073
Compiler will throw wrmog error message when same name and same erasure type constructors are delcared.
Please see the following code:
<code>
class TestConstructor<T, K> {
public TestConstructor(K k) {}
public TestConstructor(T t) {}
@SuppressWarnings("unchecked")
public static void main(String... arg){
TestConstructor tc = new TestConstructor("string");
}
}
<\code>
Ouput of the code when compiled :
<output>
Test17.java:6: reference to TestConstructor is ambiguous, both method TestConstructor(K) in TestConstructor and method TestConstructor(T) in TestConstructor match
TestConstructor tc = new TestConstructor("string");
^
1 error
</output>
---
In the error message TestConstructor(T) and TestConstructor(K) described as methods, should be constructors.
###@###.### 2005-04-17 16:24:17 GMT
Compiler will throw wrmog error message when same name and same erasure type constructors are delcared.
Please see the following code:
<code>
class TestConstructor<T, K> {
public TestConstructor(K k) {}
public TestConstructor(T t) {}
@SuppressWarnings("unchecked")
public static void main(String... arg){
TestConstructor tc = new TestConstructor("string");
}
}
<\code>
Ouput of the code when compiled :
<output>
Test17.java:6: reference to TestConstructor is ambiguous, both method TestConstructor(K) in TestConstructor and method TestConstructor(T) in TestConstructor match
TestConstructor tc = new TestConstructor("string");
^
1 error
</output>
---
In the error message TestConstructor(T) and TestConstructor(K) described as methods, should be constructors.
###@###.### 2005-04-17 16:24:17 GMT