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

Capture using super wildcard of type variables doesn't work

XMLWordPrintable

    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b99)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b99, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The test code doesn't compile with javac but
      compiles with eclipse. It seems for me that javac in wrong in this case.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile the test case

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      it should compile
      ACTUAL -
      it doesn't compile

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      JavacSuperBug.java:7: <B>m(java.util.List<? super B>,java.util.Collection<? super B>) in JavacSuperBug cannot be applied to (java.util.List<capture#293 of ? super B>,java.util.Collection<capture#954 of ? super B>)
              m(list,coll);
              ^
      1 error


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Collection;
      import java.util.List;

      public class JavacSuperBug {
          public static <B> void m(List<? super B> list,Collection<? super B> coll) {
              m(list,coll);
          }
      }
      ---------- END SOURCE ----------

            ahe Peter Ahe
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: