### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v retrieving revision 1.414 diff -u -r1.414 Parser.java --- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 7 Jan 2010 20:18:49 -0000 1.414 +++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 21 Jan 2010 17:21:53 -0000 @@ -3196,6 +3196,8 @@ anonymousType.modifiers = 0; anonymousType.bodyStart = this.scanner.currentPosition; markEnclosingMemberWithLocalType(); + consumeNestedType(); + this.variablesCounter[this.nestedType]++; pushOnAstStack(anonymousType); QualifiedAllocationExpression allocationExpression = new QualifiedAllocationExpression(anonymousType); allocationExpression.enumConstant = enumConstant; @@ -3316,6 +3318,8 @@ fieldDeclaration.declarationEnd = this.endStatementPosition; fieldDeclaration.declarationSourceEnd = anonymousType.declarationSourceEnd; this.intPtr --; // remove end position of the arguments + this.variablesCounter[this.nestedType] = 0; + this.nestedType--; } protected void consumeEnumDeclaration() { // EnumDeclaration ::= EnumHeader ClassHeaderImplementsopt EnumBody #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java,v retrieving revision 1.151 diff -u -r1.151 EnumTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 24 Sep 2009 16:21:26 -0000 1.151 +++ src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 21 Jan 2010 17:21:57 -0000 @@ -33,7 +33,7 @@ // All specified tests which does not belong to the class are skipped... static { // TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 180 }; +// TESTS_NUMBERS = new int[] { 181 }; // TESTS_RANGE = new int[] { 21, 50 }; } public static Test suite() { @@ -6524,4 +6524,29 @@ "", null); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=300133 +public void test181() { + this.runConformTest( + new String[] { + "X.java", + "public enum X {\n" + + " A {\n" + + " @Override\n" + + " public Object foo(final String s) {\n" + + " class Local {\n" + + " public String toString() {\n" + + " return s;\n" + + " }\n" + + " }\n" + + " return new Local();\n" + + " }\n" + + " };\n" + + " public abstract Object foo(String s);\n" + + " public static void main(String... args) {\n" + + " System.out.println(A.foo(\"SUCCESS\"));\n" + + " }\n" + + "}" + }, + "SUCCESS"); +} }