Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7115044 Umbrella: Add support for lambda expressions
  3. JDK-7143880

Attr.java has an unsoundness in method arguments attribution

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 8
    • tools
    • unknown
    • generic

      The following code compiles even if it shouldn't:

      1)

      class Foo<X> {
       X x;
      }

      class Test {
         void m(int i) { }

         void test(Foo<? extends Integer> fi) {
            m(fi.x);
         }
      }

      2)

      class Test<T extends Integer> {
        void i(int arg) {}
        void foo(T arg) { i(arg); }
      }

      3)

      class CaptureTest {
        <T> List<T> singleton(T arg) { return null; }
        
        void test(List<? extends Number> l) {
          List<Number> ln = singleton(l.get(0));
        }

      }

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: