Attr.java has an unsoundness in method arguments attribution

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Won't Fix
    • Priority: P3
    • None
    • Affects Version/s: 8
    • Component/s: 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));
        }

      }

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: