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

Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/AnnotationBinding.java (-1 / +3 lines)
Lines 112-119 Link Here
112
				parentElement =  ((ICompilationUnit) cu).getPackageDeclaration(pkgName);
112
				parentElement =  ((ICompilationUnit) cu).getPackageDeclaration(pkgName);
113
			}
113
			}
114
			break;
114
			break;
115
		case ASTNode.ENUM_DECLARATION:
115
		case ASTNode.TYPE_DECLARATION:
116
		case ASTNode.TYPE_DECLARATION:
116
			parentElement = ((TypeDeclaration) parent).resolveBinding().getJavaElement();
117
		case ASTNode.ANNOTATION_TYPE_DECLARATION:
118
			parentElement = ((AbstractTypeDeclaration) parent).resolveBinding().getJavaElement();
117
			break;
119
			break;
118
		case ASTNode.FIELD_DECLARATION:
120
		case ASTNode.FIELD_DECLARATION:
119
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) ((FieldDeclaration) parent).fragments().get(0);
121
			VariableDeclarationFragment fragment = (VariableDeclarationFragment) ((FieldDeclaration) parent).fragments().get(0);
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-1 / +37 lines)
Lines 46-52 Link Here
46
	}
46
	}
47
47
48
	static {
48
	static {
49
//		TESTS_NUMBERS = new int[] { 323 };
49
//		TESTS_NUMBERS = new int[] { 324, 325 };
50
//		TESTS_RANGE = new int[] { 308, -1 };
50
//		TESTS_RANGE = new int[] { 308, -1 };
51
//		TESTS_NAMES = new String[] {"test0204"};
51
//		TESTS_NAMES = new String[] {"test0204"};
52
	}
52
	}
Lines 10369-10372 Link Here
10369
			);
10369
			);
10370
		assertNotNull("No node", buildAST(contents, this.workingCopy, false, true, true));
10370
		assertNotNull("No node", buildAST(contents, this.workingCopy, false, true, true));
10371
	}
10371
	}
10372
	/*
10373
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=249844
10374
	 */
10375
	public void test0324() throws JavaModelException {
10376
		String contents =
10377
			"package test0324;\n" +
10378
			"/*start*/@Test/*end*/\n" + 
10379
			"public @interface Test {}";
10380
		this.workingCopy = getWorkingCopy(
10381
				"/Converter15/src/test0324/Test.java",
10382
				contents,
10383
				true/*resolve*/
10384
			);
10385
		MarkerAnnotation annotation = (MarkerAnnotation) buildAST(contents, this.workingCopy, true, true, true);
10386
		IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
10387
		assertNotNull("No java element", annotationBinding.getJavaElement());
10388
	}
10389
	/*
10390
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=249844
10391
	 */
10392
	public void test0325() throws JavaModelException {
10393
		String contents =
10394
			"package test0325;\n" +
10395
			"@interface Test {}\n" +
10396
			"/*start*/@Test/*end*/\n" + 
10397
			"public enum X {}";
10398
		this.workingCopy = getWorkingCopy(
10399
				"/Converter15/src/test0325/X.java",
10400
				contents,
10401
				true/*resolve*/
10402
			);
10403
		MarkerAnnotation annotation = (MarkerAnnotation) buildAST(contents, this.workingCopy, true, true, true);
10404
		IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding();
10405
		IJavaElement javaElement = annotationBinding.getJavaElement();
10406
		assertNotNull("No java element", javaElement);
10407
	}
10372
}
10408
}

Return to bug 249844