From d3e12916475820991d3b57310d0b9990c701a45f Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 1 Dec 2008 19:03:01 +0000 Subject: [PATCH] guard on field too --- .../compiler/lookup/EclipseResolvedMember.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java index e5123c882..365373c5a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java @@ -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; } -- 2.39.5