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

javac, shouldn't check nested stuck lambdas during overload resolution

    Details

    • Subcomponent:
    • Resolved In Build:
      b51
    • Verification:
      Verified

      Backports

        Description

        While attributing this test case:

        class Test {

            interface Function<X, Y> {
                Y m(X x);
            }

            interface Box<T> {
                T get();
                <R> R map(Function<T,R> f);
            }

            static class Person {
                Person(String name) { }
            }

            void print(Object arg) { }
            void print(String arg) { }

            void test() {
                Box<String> b = null;
                print(b.map(s -> new Person(s)));
            }
        }

        javac "unsticks" the implicit lambda during overload resolution, thus selecting method print(Object) as applicable. This is incorrect, method print(String) should be the one selected.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sadayapalam Srikanth Adayapalam
                  Reporter:
                  vromero Vicente Arturo Romero Zaldivar
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: