Lines 43-48
Link Here
|
43 |
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; |
43 |
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; |
44 |
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; |
44 |
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; |
45 |
import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; |
45 |
import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; |
|
|
46 |
import org.eclipse.jdt.core.dom.ArrayCreation; |
46 |
import org.eclipse.jdt.core.dom.ArrayInitializer; |
47 |
import org.eclipse.jdt.core.dom.ArrayInitializer; |
47 |
import org.eclipse.jdt.core.dom.ArrayType; |
48 |
import org.eclipse.jdt.core.dom.ArrayType; |
48 |
import org.eclipse.jdt.core.dom.AssertStatement; |
49 |
import org.eclipse.jdt.core.dom.AssertStatement; |
Lines 9354-9357
Link Here
|
9354 |
assertNotNull("No binding", packageBinding); |
9355 |
assertNotNull("No binding", packageBinding); |
9355 |
assertEquals("Wrong name", "Sample", packageBinding.getName()); |
9356 |
assertEquals("Wrong name", "Sample", packageBinding.getName()); |
9356 |
} |
9357 |
} |
|
|
9358 |
|
9359 |
/** |
9360 |
* http://dev.eclipse.org/bugs/show_bug.cgi?id=196514 |
9361 |
*/ |
9362 |
public void test0682() throws JavaModelException { |
9363 |
ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0682", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
9364 |
ASTNode node = runConversion(AST.JLS3, sourceUnit, true, true); |
9365 |
assertTrue("Not a compilation unit", node.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$ |
9366 |
CompilationUnit unit = (CompilationUnit) node; |
9367 |
assertProblemsSize( |
9368 |
unit, |
9369 |
2, |
9370 |
"Variable must provide either dimension expressions or an array initializer\n" + |
9371 |
"Syntax error on token \"String\", [ expected after this token"); |
9372 |
node = getASTNode(unit, 0, 1, 0); |
9373 |
assertEquals("Not a expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); |
9374 |
ExpressionStatement expressionStatement = (ExpressionStatement) node; |
9375 |
node = expressionStatement.getExpression(); |
9376 |
assertEquals("Not a method invocation", ASTNode.METHOD_INVOCATION, node.getNodeType()); |
9377 |
MethodInvocation methodInvocation = (MethodInvocation) node; |
9378 |
List arguments = methodInvocation.arguments(); |
9379 |
assertEquals("Wrong size", 1, arguments.size()); |
9380 |
node = (ASTNode)arguments.get(0); |
9381 |
assertEquals("Not an array creation", ASTNode.ARRAY_CREATION, node.getNodeType()); |
9382 |
ArrayCreation arrayCreation = (ArrayCreation) node; |
9383 |
ArrayType arrayType = arrayCreation.getType(); |
9384 |
checkSourceRange(arrayType, "String]", sourceUnit.getSource()); |
9385 |
} |
9386 |
|
9387 |
/** |
9388 |
* http://dev.eclipse.org/bugs/show_bug.cgi?id=196514 |
9389 |
*/ |
9390 |
public void test0683() throws JavaModelException { |
9391 |
ICompilationUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0683", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
9392 |
ASTNode node = runConversion(AST.JLS3, sourceUnit, true, true); |
9393 |
assertTrue("Not a compilation unit", node.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$ |
9394 |
CompilationUnit unit = (CompilationUnit) node; |
9395 |
assertProblemsSize(unit, 0); |
9396 |
node = getASTNode(unit, 0, 1, 0); |
9397 |
assertEquals("Not a expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); |
9398 |
ExpressionStatement expressionStatement = (ExpressionStatement) node; |
9399 |
node = expressionStatement.getExpression(); |
9400 |
assertEquals("Not a method invocation", ASTNode.METHOD_INVOCATION, node.getNodeType()); |
9401 |
MethodInvocation methodInvocation = (MethodInvocation) node; |
9402 |
List arguments = methodInvocation.arguments(); |
9403 |
assertEquals("Wrong size", 1, arguments.size()); |
9404 |
node = (ASTNode)arguments.get(0); |
9405 |
assertEquals("Not an array creation", ASTNode.ARRAY_CREATION, node.getNodeType()); |
9406 |
ArrayCreation arrayCreation = (ArrayCreation) node; |
9407 |
ArrayType arrayType = arrayCreation.getType(); |
9408 |
checkSourceRange(arrayType, "String[0][b[10]][]", sourceUnit.getSource()); |
9409 |
node = arrayType.getComponentType(); |
9410 |
assertEquals("Not an array type", ASTNode.ARRAY_TYPE, node.getNodeType()); |
9411 |
arrayType = (ArrayType)node; |
9412 |
checkSourceRange(arrayType, "String[0][b[10]]", sourceUnit.getSource()); |
9413 |
node = arrayType.getComponentType(); |
9414 |
assertEquals("Not an array type", ASTNode.ARRAY_TYPE, node.getNodeType()); |
9415 |
arrayType = (ArrayType)node; |
9416 |
checkSourceRange(arrayType, "String[0]", sourceUnit.getSource()); |
9417 |
} |
9357 |
} |
9418 |
} |