Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2006, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2006, 2011 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 1077-1080
Link Here
|
1077 |
checkSourceRange(anonymousClassDeclaration, "new Object() {hash}", source); //$NON-NLS-1$ |
1077 |
checkSourceRange(anonymousClassDeclaration, "new Object() {hash}", source); //$NON-NLS-1$ |
1078 |
checkSourceRange(assignment, "field= new Object() {hash}", source); //$NON-NLS-1$ |
1078 |
checkSourceRange(assignment, "field= new Object() {hash}", source); //$NON-NLS-1$ |
1079 |
} |
1079 |
} |
|
|
1080 |
|
1081 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340691 |
1082 |
public void test0021() throws JavaModelException { |
1083 |
this.workingCopies = new ICompilationUnit[1]; |
1084 |
this.workingCopies[0] = getWorkingCopy( |
1085 |
"/Converter/src/test/X.java", |
1086 |
"package test;\n"+ |
1087 |
"public class X {\n"+ |
1088 |
" void foo() {\n" + |
1089 |
" synchronized new Object();\n" + |
1090 |
" }\n" + |
1091 |
"}\n"); |
1092 |
ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true); |
1093 |
|
1094 |
assertASTNodeEquals( |
1095 |
"package test;\n" + |
1096 |
"public class X {\n" + |
1097 |
" void foo(){\n" + |
1098 |
" }\n" + |
1099 |
"}\n", |
1100 |
result); |
1101 |
|
1102 |
ASTNode node = getASTNode((CompilationUnit) result, 0, 0); |
1103 |
assertNotNull(node); |
1104 |
assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ |
1105 |
MethodDeclaration methodDeclaration = (MethodDeclaration) node; |
1106 |
Block block = methodDeclaration.getBody(); |
1107 |
List statements = block.statements(); |
1108 |
assertEquals("wrong size", 0, statements.size()); //$NON-NLS-1$ |
1109 |
} |
1080 |
} |
1110 |
} |