test/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest1.java

Tue, 29 Mar 2016 10:48:49 +0000

author
dbuck
date
Tue, 29 Mar 2016 10:48:49 +0000
changeset 3102
e74dd6df4d4c
parent 2567
9a3e5ce68cef
permissions
-rw-r--r--

8143647: Javac compiles method reference that allows results in an IllegalAccessError
Summary: Lambda implementation method synthesized by javac should not mention inaccessible types.
Reviewed-by: mcimadamore

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8033483
     4  * @summary Should ignore nested lambda bodies during overload resolution
     5  * @compile/fail/ref=IgnoreLambdaBodyDuringResolutionTest1.out -XDrawDiagnostics IgnoreLambdaBodyDuringResolutionTest1.java
     6  */
     8 class IgnoreLambdaBodyDuringResolutionTest1 {
     9     interface SAM<T> {
    10         T action(T t);
    11     }
    13     <T> T m(SAM<T> op) {
    14         return null;
    15     }
    17     class B {
    18         B x() {
    19             return this;
    20         }
    21     }
    23     class C {}
    25     void foo(B arg) {}
    26     void foo(C arg) {}
    28     void bar() {
    29         foo(m(arg -> new B()));
    30     }
    31 }

mercurial