Lines 3398-3400
Link Here
|
3398 |
assertTrue("binding is static", (binding.getModifiers() & Modifier.STATIC) != 0); |
3398 |
assertTrue("binding is static", (binding.getModifiers() & Modifier.STATIC) != 0); |
3399 |
} |
3399 |
} |
|
|
3400 |
|
3401 |
/* |
3402 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=420660 |
3403 |
*/ |
3404 |
public void testBug420660() throws JavaModelException { |
3405 |
String contents = |
3406 |
"public class X {\n" + |
3407 |
" public void foo(int p, int q) {\n" + |
3408 |
" int i = 0, j = 1;\n" + |
3409 |
" q = 0;\n" + |
3410 |
" j = 0;\n" + |
3411 |
" }\n" + |
3412 |
"}"; |
3413 |
this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); |
3414 |
ASTNode node = buildAST( |
3415 |
contents, |
3416 |
this.workingCopy); |
3417 |
assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); |
3418 |
CompilationUnit compilationUnit = (CompilationUnit) node; |
3419 |
assertProblemsSize(compilationUnit, 0); |
3420 |
node = getASTNode(compilationUnit, 0); |
3421 |
assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); |
3422 |
MethodDeclaration[] methods = ((TypeDeclaration) node).getMethods(); |
3423 |
assertEquals("Incorrect no of methods", 1, methods.length); |
3424 |
MethodDeclaration method = methods[0]; |
3425 |
List params = method.parameters(); |
3426 |
assertEquals("Incorrect no of parameters", 2, params.size()); |
3427 |
SingleVariableDeclaration param = (SingleVariableDeclaration) params.get(0); |
3428 |
IVariableBinding binding = param.resolveBinding(); |
3429 |
assertTrue("Should be effectively final", binding.isEffectivelyFinal()); |
3430 |
param = (SingleVariableDeclaration) params.get(1); |
3431 |
binding = param.resolveBinding(); |
3432 |
assertFalse("Should not be effectively final", binding.isEffectivelyFinal()); |
3433 |
|
3434 |
List statements = method.getBody().statements(); |
3435 |
VariableDeclarationStatement statement = (VariableDeclarationStatement) statements.get(0); |
3436 |
List fragments = statement.fragments(); |
3437 |
VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); |
3438 |
binding = fragment.resolveBinding(); |
3439 |
assertTrue("Should be effectively final", binding.isEffectivelyFinal()); |
3440 |
fragment = (VariableDeclarationFragment) fragments.get(1); |
3441 |
binding = fragment.resolveBinding(); |
3442 |
assertFalse("Should not be effectively final", binding.isEffectivelyFinal()); |
3443 |
} |
3400 |
} |
3444 |
} |