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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (+43 lines)
Lines 9098-9101 Link Here
9098
		CompilationUnit unit = (CompilationUnit) node;
9098
		CompilationUnit unit = (CompilationUnit) node;
9099
		assertProblemsSize(unit, 1, "The type A is not generic; it cannot be parameterized with arguments <?>");
9099
		assertProblemsSize(unit, 1, "The type A is not generic; it cannot be parameterized with arguments <?>");
9100
	}
9100
	}
9101
	
9102
	/*
9103
	 * Test ability to distinguish AST nodes of multiple similar annotations.
9104
	 */
9105
	public void test0999() throws JavaModelException {
9106
		this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/);
9107
		String contents =
9108
			"@interface Annot {\n" +
9109
			"  public int value();\n" +
9110
			"}\n" +
9111
			"\n" + 
9112
			"public class X {\n" +
9113
			"  @Annot(1) String foo1() { return null; }\n" +
9114
			"  @Annot(1) String foo2() { return null; }\n" +
9115
			"}";
9116
		this.workingCopy.getBuffer().setContents(contents);
9117
		
9118
		class CompilationUnitRequestor extends ASTRequestor
9119
		{	
9120
			public void acceptAST(ICompilationUnit source, CompilationUnit node) {
9121
				MethodDeclaration methodDeclaration = (MethodDeclaration)getASTNode(node, 1, 0);
9122
				IMethodBinding methodBinding = methodDeclaration.resolveBinding();
9123
				IAnnotationBinding annoBinding = methodBinding.getAnnotations()[0];
9124
				ASTNode annoNode = node.findDeclaringNode(annoBinding);
9125
				int position1 = annoNode.getStartPosition();
9126
9127
				methodDeclaration = (MethodDeclaration)getASTNode(node, 1, 1);
9128
				methodBinding = methodDeclaration.resolveBinding();
9129
				annoBinding = methodBinding.getAnnotations()[0];
9130
				annoNode = node.findDeclaringNode(annoBinding);
9131
				int position2 = annoNode.getStartPosition();
9132
				assertTrue("Anno 2 position <= anno 1 position", position2 > position1);
9133
			}
9134
		}
9135
		
9136
		CompilationUnitRequestor requestor = new CompilationUnitRequestor();
9137
		ASTParser p = ASTParser.newParser( AST.JLS3 );
9138
		p.setResolveBindings( true );
9139
		p.setProject( this.getJavaProject("Converter15") );
9140
		p.setKind( ASTParser.K_COMPILATION_UNIT );
9141
		p.createASTs( new ICompilationUnit[]{this.workingCopy}, new String[0],  requestor, null);
9142
	}
9143
9101
}
9144
}

Return to bug 192774