Skip to content

Commit 044283f

Browse files
1 parent 7456b4f commit 044283f

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7918,6 +7918,40 @@ public void testBug551882() {
79187918
);
79197919
}
79207920

7921+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=511958
7922+
// [1.8][compiler] Discrepancy with javac behavior when handling inner classes and lambdas
7923+
public void testBug511958() {
7924+
this.runConformTest(
7925+
new String[] {
7926+
"X.java",
7927+
"import java.util.function.Consumer;\n" +
7928+
"@SuppressWarnings(\"all\")\n" +
7929+
"public class X {\n" +
7930+
" private final String text = \"Bug?\";\n" +
7931+
" public static void main(String[] args) {\n" +
7932+
" new X().doIt();\n" +
7933+
" }\n" +
7934+
" \n" +
7935+
" private void doIt() {\n" +
7936+
" new Sub();\n" +
7937+
" }\n" +
7938+
" private class Super<T> {\n" +
7939+
" public Super(String s) {}\n" +
7940+
" public Super(Consumer<T> consumer) {\n" +
7941+
" }\n" +
7942+
" }\n" +
7943+
" private class Sub extends Super<String> {\n" +
7944+
" public Sub() {\n" +
7945+
" super(s -> System.out.println(text)); \n" +
7946+
" }\n" +
7947+
" \n" +
7948+
" }\n" +
7949+
"}\n"},
7950+
""
7951+
);
7952+
}
7953+
7954+
79217955
public static Class testClass() {
79227956
return LambdaExpressionsTest.class;
79237957
}

0 commit comments

Comments
 (0)