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

generics: problems with proposed signature for Collections.unmodifiableCollectio

    XMLWordPrintable

Details

    • generic
    • solaris_8

    Description

      ==============================> cat -n T.java
           1 import java.util.*;
           2
           3 class Collections2 {
           4 // proposed signature for Collections.unmodifiableCollection
           5 public static <T, S extends T> Collection<T>
           6 umc(Collection<S> c) {
           7 return null;
           8 }
           9 }
          10
          11 class Test {
          12 public static void main(String[] args) {
          13 Collection<Integer> c1 = null;
          14 Collection<Number> c2 = Collections2.umc(c1);
          15 }
          16 }
      ==============================> jsr14javac -gj T.java
      T.java:14: umc<T, S extends T>(java.util.Collection<S>) in Collections2 cannot be applied to (java.util.Collection<java.lang.Integer>)
              Collection<Number> c2 = Collections2.umc(c1);
                                                  ^
      1 error
      ==============================>

      Attachments

        Activity

          People

            gafter Neal Gafter
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: