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

Regression: difference in overload resolution when two methods are maximally specific

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b06
    • CPU:
      unknown
    • OS:
      generic

      Backports

        Description

        This program no longer compiles in JDK 7:

        import java.util.*;

        interface A { List<Number> getList(); }
        interface B { List getList(); }
        interface AB extends A, B {}

        class Test {
           void test(AB ab) {
              Number n = ab.getList().get(1); //error here
           }
        }


        OUTPUT:

        Test.java:17: error: incompatible types
                Number n = ab.getList().get(1);
                           ^
          required: Number
          found: Object
        1 error

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: