Fixed bug 476281 - [1.8] Using a local class inside a lambda inside an
enum constant triggers a VerifyError

Change-Id: Ifdce1d87439631450052e2e5cbb9d9c26f53b70d
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java
index 653f5ae..396eebb 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.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
@@ -7117,4 +7117,51 @@
 			"\n"
 	});
 }
+public void test476281() {
+	if (this.complianceLevel < ClassFileConstants.JDK1_8)
+		return;
+	this.runConformTest(new String[] {
+			"LambdaEnumLocalClassBug.java",
+			"public enum LambdaEnumLocalClassBug {\n" + 
+			"  A(() -> {\n" + 
+			"    class Foo {\n" + 
+			"    }\n" + 
+			"    new Foo();\n" + 
+			"    System.out.println(\"Success\");\n" +
+			"  })\n" + 
+			";\n" + 
+			"  private final Runnable runnable;\n" + 
+			"  private LambdaEnumLocalClassBug(Runnable runnable) {\n" + 
+			"    this.runnable = runnable;\n" + 
+			"  }\n" + 
+			"  public static void main(String[] args) {\n" + 
+			"    A.runnable.run();\n" + 
+			"  }\n" + 
+			"}"},
+			"Success");
+}
+public void test476281a() {
+	this.runConformTest(new String[] {
+			"Test.java",
+			"public enum Test {\n" + 
+			"  B(new Runnable() {\n" + 
+			"	public void run() {\n" + 
+			"		//\n" + 
+			"		class Foo {\n" + 
+			"			\n" + 
+			"		}\n" + 
+			"		new Foo();\n" + 
+			"    System.out.println(\"Success\");\n" +
+			"	}\n" + 
+			"});\n" + 
+			"  private final Runnable runnable;\n" + 
+			"  private Test(Runnable runnable) {\n" + 
+			"    this.runnable = runnable;\n" + 
+			"  }\n" + 
+			"  public static void main(String[] args) {\n" + 
+			"    B.runnable.run();\n" + 
+			"  }\n" + 
+			"}"},
+			"Success");
+}
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 1893d20..a4273a8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -2600,7 +2600,7 @@
 						}
 					}
 				}
-				typeDecl.createDefaultConstructor(!this.diet || insideFieldInitializer, true);
+				typeDecl.createDefaultConstructor(!(this.diet && this.dietInt == 0) || insideFieldInitializer, true);
 		}
 	}
 	//always add <clinit> (will be remove at code gen time if empty)