]> source.dussan.org Git - aspectj.git/commitdiff
guard on field too
authoraclement <aclement>
Mon, 1 Dec 2008 19:03:01 +0000 (19:03 +0000)
committeraclement <aclement>
Mon, 1 Dec 2008 19:03:01 +0000 (19:03 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java

index e5123c88298ef11c271f2f3bf9ead33a630dd0f5..365373c5a18eb84cbda512e5882f757747ec5f18 100644 (file)
@@ -197,16 +197,15 @@ public class EclipseResolvedMember extends ResolvedMemberImpl {
        }
 
        private Annotation[] getEclipseAnnotations() {
-               if (realBinding instanceof MethodBinding) {
-                       TypeDeclaration tDecl = getTypeDeclaration();
-                       if (tDecl == null) {
-                               return null; // if the code is broken then tDecl may be null
+               TypeDeclaration tDecl = getTypeDeclaration();
+               if (tDecl != null) {// if the code is broken then tDecl may be null
+                       if (realBinding instanceof MethodBinding) {
+                               AbstractMethodDeclaration methodDecl = tDecl.declarationOf((MethodBinding) realBinding);
+                               return methodDecl.annotations;
+                       } else if (realBinding instanceof FieldBinding) {
+                               FieldDeclaration fieldDecl = tDecl.declarationOf((FieldBinding) realBinding);
+                               return fieldDecl.annotations;
                        }
-                       AbstractMethodDeclaration methodDecl = tDecl.declarationOf((MethodBinding) realBinding);
-                       return methodDecl.annotations;
-               } else if (realBinding instanceof FieldBinding) {
-                       FieldDeclaration fieldDecl = getTypeDeclaration().declarationOf((FieldBinding) realBinding);
-                       return fieldDecl.annotations;
                }
                return null;
        }