### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: dom/org/eclipse/jdt/core/dom/AnnotationBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationBinding.java,v retrieving revision 1.11 diff -u -r1.11 AnnotationBinding.java --- dom/org/eclipse/jdt/core/dom/AnnotationBinding.java 27 Jun 2008 16:03:46 -0000 1.11 +++ dom/org/eclipse/jdt/core/dom/AnnotationBinding.java 16 Oct 2008 15:28:48 -0000 @@ -112,8 +112,10 @@ parentElement = ((ICompilationUnit) cu).getPackageDeclaration(pkgName); } break; + case ASTNode.ENUM_DECLARATION: case ASTNode.TYPE_DECLARATION: - parentElement = ((TypeDeclaration) parent).resolveBinding().getJavaElement(); + case ASTNode.ANNOTATION_TYPE_DECLARATION: + parentElement = ((AbstractTypeDeclaration) parent).resolveBinding().getJavaElement(); break; case ASTNode.FIELD_DECLARATION: VariableDeclarationFragment fragment = (VariableDeclarationFragment) ((FieldDeclaration) parent).fragments().get(0); #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v retrieving revision 1.278 diff -u -r1.278 ASTConverter15Test.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 22 Sep 2008 16:22:19 -0000 1.278 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 16 Oct 2008 15:28:49 -0000 @@ -46,7 +46,7 @@ } static { -// TESTS_NUMBERS = new int[] { 323 }; +// TESTS_NUMBERS = new int[] { 324, 325 }; // TESTS_RANGE = new int[] { 308, -1 }; // TESTS_NAMES = new String[] {"test0204"}; } @@ -10369,4 +10369,40 @@ ); assertNotNull("No node", buildAST(contents, this.workingCopy, false, true, true)); } + /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=249844 + */ + public void test0324() throws JavaModelException { + String contents = + "package test0324;\n" + + "/*start*/@Test/*end*/\n" + + "public @interface Test {}"; + this.workingCopy = getWorkingCopy( + "/Converter15/src/test0324/Test.java", + contents, + true/*resolve*/ + ); + MarkerAnnotation annotation = (MarkerAnnotation) buildAST(contents, this.workingCopy, true, true, true); + IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding(); + assertNotNull("No java element", annotationBinding.getJavaElement()); + } + /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=249844 + */ + public void test0325() throws JavaModelException { + String contents = + "package test0325;\n" + + "@interface Test {}\n" + + "/*start*/@Test/*end*/\n" + + "public enum X {}"; + this.workingCopy = getWorkingCopy( + "/Converter15/src/test0325/X.java", + contents, + true/*resolve*/ + ); + MarkerAnnotation annotation = (MarkerAnnotation) buildAST(contents, this.workingCopy, true, true, true); + IAnnotationBinding annotationBinding = annotation.resolveAnnotationBinding(); + IJavaElement javaElement = annotationBinding.getJavaElement(); + assertNotNull("No java element", javaElement); + } } \ No newline at end of file