Tue, 29 Mar 2016 10:48:49 +0000
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 }