View | Details | Raw Unified | Return to bug 125807 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (+32 lines)
Lines 6280-6283 Link Here
6280
		assertNotNull("Should not be null", annotations);
6280
		assertNotNull("Should not be null", annotations);
6281
		assertEquals("Should be empty", 0, annotations.length);
6281
		assertEquals("Should be empty", 0, annotations.length);
6282
	}
6282
	}
6283
	
6284
	/*
6285
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=125807
6286
	 */
6287
	public void test0208() throws JavaModelException {
6288
		this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/);
6289
		String contents =
6290
			"@Override(x= 1)\r\n" + 
6291
			"public class X { }";
6292
		ASTNode node = buildAST(
6293
				contents,
6294
				this.workingCopy,
6295
				false);
6296
		assertNotNull("No node", node);
6297
		assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
6298
		CompilationUnit compilationUnit = (CompilationUnit) node;
6299
		String problems =
6300
			"The annotation @Override is disallowed for this location\n" + 
6301
			"The attribute x is undefined for the annotation type Override";
6302
		assertProblemsSize(compilationUnit, 2, problems);
6303
		node = getASTNode(compilationUnit, 0);
6304
		assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
6305
		TypeDeclaration typeDeclaration = (TypeDeclaration) node;
6306
		List modifiers = typeDeclaration.modifiers();
6307
		assertEquals("Wrong size", 2, modifiers.size());
6308
		assertTrue("Wrong type", modifiers.get(0) instanceof NormalAnnotation);
6309
		NormalAnnotation normalAnnotation = (NormalAnnotation) modifiers.get(0);
6310
		IResolvedAnnotation resolvedAnnotation = normalAnnotation.resolveAnnotation();
6311
		IResolvedMemberValuePair[] pairs = resolvedAnnotation.getDeclaredMemberValuePairs();
6312
		assertEquals("Wrong size", 1, pairs.length);
6313
		assertNotNull("Should not be null", pairs[0].getValue());
6314
	}
6283
}
6315
}

Return to bug 125807