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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-1 / +77 lines)
Lines 46-52 Link Here
46
	}
46
	}
47
47
48
	static {
48
	static {
49
//		TESTS_NUMBERS = new int[] { 217 };
49
//		TESTS_NUMBERS = new int[] { 218 };
50
//		TESTS_NAMES = new String[] {"test0204"};
50
//		TESTS_NAMES = new String[] {"test0204"};
51
	}
51
	}
52
	public static Test suite() {
52
	public static Test suite() {
Lines 6835-6838 Link Here
6835
		typeArguments = typeBinding2.getTypeArguments();
6835
		typeArguments = typeBinding2.getTypeArguments();
6836
		assertEquals("Wrong size", 0, typeArguments.length);
6836
		assertEquals("Wrong size", 0, typeArguments.length);
6837
	}
6837
	}
6838
	
6839
	/*
6840
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=140318
6841
	 */
6842
	public void test0218() throws JavaModelException {
6843
    	this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/);
6844
    	String contents =
6845
			"import java.util.List;\n" + 
6846
			"\n" + 
6847
			"public class X {\n" + 
6848
			"	/**\n" + 
6849
			"	 * @category fo\n" + 
6850
			"	 */\n" + 
6851
			"	@Test private int fXoo;\n" + 
6852
			"}";
6853
	   	ASTNode node = buildAST(
6854
				contents,
6855
    			this.workingCopy,
6856
    			false);
6857
		assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
6858
		CompilationUnit unit = (CompilationUnit) node;
6859
		assertProblemsSize(unit, 1, "Test cannot be resolved to a type");
6860
		node = getASTNode(unit, 0, 0);
6861
		assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
6862
		FieldDeclaration declaration = (FieldDeclaration) node;
6863
		List modifiers = declaration.modifiers();
6864
		assertEquals("wrong size", 2, modifiers.size());
6865
		assertEquals("Not a marker annotation", ASTNode.MARKER_ANNOTATION, ((ASTNode) modifiers.get(0)).getNodeType());
6866
		MarkerAnnotation annotation = (MarkerAnnotation) modifiers.get(0);
6867
		Name name = annotation.getTypeName();
6868
		assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
6869
		ITypeBinding binding = name.resolveTypeBinding();
6870
		assertNull("Got a binding", binding);
6871
		IBinding binding2 = name.resolveBinding();
6872
		assertNull("Got a binding", binding2);
6873
		IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
6874
		assertNull("Got a binding", annotationBinding);
6875
	}
6876
	/*
6877
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=140318
6878
	 */
6879
	public void test0219() throws JavaModelException {
6880
    	this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/);
6881
    	String contents =
6882
			"import java.util.List;\n" + 
6883
			"\n" + 
6884
			"public class X {\n" + 
6885
			"	/**\n" + 
6886
			"	 * @category fo\n" + 
6887
			"	 */\n" + 
6888
			"	@Test private int fXoo;\n" + 
6889
			"}\n" +
6890
			"class Test {}";
6891
	   	ASTNode node = buildAST(
6892
				contents,
6893
    			this.workingCopy,
6894
    			false);
6895
		assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
6896
		CompilationUnit unit = (CompilationUnit) node;
6897
		assertProblemsSize(unit, 1, "Type mismatch: cannot convert from Test to Annotation");
6898
		node = getASTNode(unit, 0, 0);
6899
		assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
6900
		FieldDeclaration declaration = (FieldDeclaration) node;
6901
		List modifiers = declaration.modifiers();
6902
		assertEquals("wrong size", 2, modifiers.size());
6903
		assertEquals("Not a marker annotation", ASTNode.MARKER_ANNOTATION, ((ASTNode) modifiers.get(0)).getNodeType());
6904
		MarkerAnnotation annotation = (MarkerAnnotation) modifiers.get(0);
6905
		Name name = annotation.getTypeName();
6906
		assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
6907
		ITypeBinding binding = name.resolveTypeBinding();
6908
		assertNotNull("No binding", binding);
6909
		IBinding binding2 = name.resolveBinding();
6910
		assertNotNull("No binding", binding2);
6911
		IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
6912
		assertNull("Got a binding", annotationBinding);
6913
	}
6838
}
6914
}

Return to bug 140318