Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v retrieving revision 1.65 diff -u -r1.65 ASTConverterTestAST3_2.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 15 Sep 2005 18:48:55 -0000 1.65 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 21 Sep 2005 01:44:11 -0000 @@ -106,7 +106,7 @@ static { // TESTS_NAMES = new String[] {"test0602"}; -// TESTS_NUMBERS = new int[] { 619 }; +// TESTS_NUMBERS = new int[] { 621 }; } public static Test suite() { return buildTestSuite(ASTConverterTestAST3_2.class); @@ -6746,8 +6746,8 @@ ICompilationUnit workingCopy = null; try { String contents = - "public class X {\r\n" + - " String f = \"\" + \"\" - 1;\r\n" + + "public class X {\n" + + " String f = \"\" + \"\" - 1;\n" + "}"; workingCopy = getWorkingCopy("/Converter/src/X.java", false/*resolve*/); ASTNode node = buildAST( @@ -6812,4 +6812,42 @@ VariableDeclarationStatement declarationStatement = (VariableDeclarationStatement) statement2; assertEquals("Wrong number of fragments", 4, declarationStatement.fragments().size()); } + /** + * http://dev.eclipse.org/bugs/show_bug.cgi?id=109646 + */ + public void test0621() throws JavaModelException { + ICompilationUnit workingCopy = null; + try { + String contents = + "public class X {\n" + + " public void foo(int y) {\n" + + " switch (y) {\n" + + " case 1:\n" + + " int i,j;\n" + + " }\n" + + " }\n" + + "}"; + workingCopy = getWorkingCopy("/Converter/src/X.java", false/*resolve*/); + ASTNode node = buildAST( + contents, + workingCopy, + false); + assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); + CompilationUnit unit = (CompilationUnit) node; + assertProblemsSize(unit, 0); + node = getASTNode(unit, 0, 0, 0); + assertNotNull("No node", node); + assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, node.getNodeType()); + SwitchStatement switchStatement = (SwitchStatement) node; + List statements = switchStatement.statements(); + assertEquals("Wrong size", 2, statements.size()); + Statement statement = (Statement) statements.get(1); + assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType()); + VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement; + assertEquals("Wrong size", 2, variableDeclarationStatement.fragments().size()); + } finally { + if (workingCopy != null) + workingCopy.discardWorkingCopy(); + } + } }