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

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

XMLWordPrintable

    • b51
    • Verified

        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.

              sadayapalam Srikanth Adayapalam (Inactive)
              vromero Vicente Arturo Romero Zaldivar
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: