Lines 6199-6203
Link Here
|
6199 |
IBinding[] bindings = resolveBindings(contents, this.workingCopy); |
6199 |
IBinding[] bindings = resolveBindings(contents, this.workingCopy); |
6200 |
assertFalse("Declaration and reference keys should not be the same", bindings[0].getKey().equals(bindings[1].getKey())); |
6200 |
assertFalse("Declaration and reference keys should not be the same", bindings[0].getKey().equals(bindings[1].getKey())); |
6201 |
} |
6201 |
} |
|
|
6202 |
|
6203 |
/* |
6204 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=120263 |
6205 |
*/ |
6206 |
public void test0206() throws JavaModelException { |
6207 |
this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); |
6208 |
String contents = |
6209 |
"public class X {\n" + |
6210 |
" public @interface Annot {\n" + |
6211 |
" }\n" + |
6212 |
" @Annot(newAttrib= {1, 2})\n" + |
6213 |
" public void foo() {\n" + |
6214 |
" }\n" + |
6215 |
"}"; |
6216 |
ASTNode node = buildAST( |
6217 |
contents, |
6218 |
this.workingCopy, |
6219 |
false); |
6220 |
assertNotNull("No node", node); |
6221 |
assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); |
6222 |
CompilationUnit compilationUnit = (CompilationUnit) node; |
6223 |
assertProblemsSize(compilationUnit, 1, "The attribute newAttrib is undefined for the annotation type X.Annot"); |
6224 |
node = getASTNode(compilationUnit, 0, 1); |
6225 |
assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType()); |
6226 |
MethodDeclaration methodDeclaration = (MethodDeclaration) node; |
6227 |
List modifiers = methodDeclaration.modifiers(); |
6228 |
assertEquals("Wrong size", 2, modifiers.size()); |
6229 |
IExtendedModifier extendedModifier = (IExtendedModifier) modifiers.get(0); |
6230 |
assertTrue("Not a normal annotation", extendedModifier instanceof NormalAnnotation); |
6231 |
NormalAnnotation annotation = (NormalAnnotation) extendedModifier; |
6232 |
List values = annotation.values(); |
6233 |
assertEquals("Wrong size", 1, values.size()); |
6234 |
MemberValuePair memberValuePair = (MemberValuePair) values.get(0); |
6235 |
Expression value = memberValuePair.getValue(); |
6236 |
assertEquals("Not an array initializer", ASTNode.ARRAY_INITIALIZER, value.getNodeType()); |
6237 |
ArrayInitializer arrayInitializer = (ArrayInitializer) value; |
6238 |
ITypeBinding typeBinding = arrayInitializer.resolveTypeBinding(); |
6239 |
assertNotNull("No binding", typeBinding); |
6240 |
} |
6202 |
|
6241 |
|
6203 |
} |
6242 |
} |