Fixed bug 467825: Missing code implementation in the compiler
Change-Id: Ib461af83192700608dfe82fb324cd9203db663d0
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=467825
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
index e0c74e8..e489fbd 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
@@ -5622,7 +5622,56 @@
"}\n"},
"one::two");
}
-
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=467825 Missing code implementation in the compiler
+public void test467825() {
+ this.runConformTest(
+ new String[] {
+ "Main.java",
+ "import java.util.function.Function;\n" +
+ "public class Main {\n" +
+ " public Function<String, String> f(int x) {\n" +
+ " class A {\n" +
+ " void g() {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " return s -> {\n" +
+ " A a = new A();\n" +
+ " return s;\n" +
+ " };\n" +
+ " }\n" +
+ "}\n"
+ });
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=467825 Missing code implementation in the compiler
+public void test467825a() {
+ this.runConformTest(
+ new String[] {
+ "Test.java",
+ "import java.util.function.Function;\n" +
+ "interface Foo {void alpha(Bar pBar);}\n" +
+ "class Bar {Object bravo() {return null;}}\n" +
+ "class Test {\n" +
+ " Foo foo(Function pFunction) {\n" +
+ " class Baz {\n" +
+ " public Baz(Object pObj) {\n" +
+ " }\n" +
+ " class NestedBaz extends Baz {\n" +
+ " NestedBaz(Object pObj) {\n" +
+ " super(pObj);\n" +
+ " pFunction.apply(pObj);\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ " return pBar -> {\n" +
+ " Object o = new Baz(pBar).new NestedBaz(pBar.bravo());\n" +
+ " };\n" +
+ " }\n" +
+ " void charlie(Object pRemovals) {}\n" +
+ " void delta(Foo pListener) {}\n" +
+ "}\n"
+ });
+}
public static Class testClass() {
return LambdaExpressionsTest.class;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index 4c8e4e1..b35f4f6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -264,7 +264,7 @@
// perform some emulation work in case there is some and we are inside a local type only
if (allocatedTypeErasure.isNestedType()
- && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaScope())) {
+ && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaSubscope())) {
if (allocatedTypeErasure.isLocalType()) {
((LocalTypeBinding) allocatedTypeErasure).addInnerEmulationDependent(currentScope, false);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index ff66190..416812e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -256,7 +256,7 @@
// perform some extra emulation work in case there is some and we are inside a local type only
if (allocatedTypeErasure.isNestedType()
- && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaScope())) {
+ && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaSubscope())) {
if (allocatedTypeErasure.isLocalType()) {
((LocalTypeBinding) allocatedTypeErasure).addInnerEmulationDependent(currentScope, this.enclosingInstance != null);