Community
Participate
Working Groups
3.1M2, java 1.5.0rc The following code compiles fine on the command line, but Eclipse doesn't like it: class MyClass<T> { private T thing; public MyClass(T thing) { this.thing = thing; } public static <U> MyClass<U> factoryMakeMyClass(U thing) { return new MyClass<U>(thing); } } class External { public static <U> MyClass<U> factoryMakeMyClass(U thing) { return new MyClass<U>(thing); } } class Test { public static void test() { // No problem with this line: MyClass<String> foo = External.factoryMakeMyClass("hi"); // This line gives me an error: // Type mismatch: cannot convert from MyClass<Object> to MyClass<String> MyClass<String> bar = MyClass.factoryMakeMyClass("hi"); } }
*** This bug has been marked as a duplicate of 76313 ***