JDK-6570321 : javac rejects valid assignment for incompatible types
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2007-06-15
  • Updated: 2010-04-02
  • Resolved: 2009-01-05
Related Reports
Relates :  
Description
MyClass is rejected by javac with the following error:

incompatible types
found : java.util.Collection<java.lang.String>
required: java.util.Collection<java.lang.Object>

-----------------------------------------------------------------------
import java.util.Collection;

public class MyClass {
public static <E, F extends E> Collection<E> foo(F val) { return null; }

public static void tryIt() { Collection<Object> obj = foo("bar"); }
}