### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java,v retrieving revision 1.28 diff -u -r1.28 SyntaxErrorTest.java --- src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java 7 Jul 2010 05:55:47 -0000 1.28 +++ src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java 7 Jul 2010 06:26:06 -0000 @@ -479,4 +479,46 @@ expectedSyntaxErrorDiagnosis, testName); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=210419 +public void test15() { + + String s = + "package bug;\n" + + "public class Test {\n" + + " static int X;\n" + + " String field = { String str;\n" + + " switch (X) {\n" + + " case 0:\n" + + " str = \"zero\";\n" + + " break;\n" + + " default:\n" + + " str = \"other\";\n" + + " break;\n" + + " }\n" + + " this.field = str;\n" + + " };\n" + + " public static void main(String[] args) {\n" + + " System.out.println(new Test().field);\n" + + " }\n" + + "}\n"; + + String expectedSyntaxErrorDiagnosis = + "----------\n" + + "1. ERROR in (at line 4)\n" + + " String field = { String str;\n" + + " ^^^^^^^^\n" + + "Syntax error on token(s), misplaced construct(s)\n" + + "----------\n" + + "2. ERROR in (at line 4)\n" + + " String field = { String str;\n" + + " ^\n" + + "Syntax error on token \";\", { expected after this token\n" + + "----------\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedSyntaxErrorDiagnosis, + testName); +} }