Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6570321

javac rejects valid assignment for incompatible types

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      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"); }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                wtaosunw Wei Tao (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: