From 499b7ededbc7e9ef38ac0173cb56483ad6a6610f Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 10 Aug 2010 23:48:23 +0000 Subject: [PATCH] 322272: declare annotation for incremental compilation when used through abstract aspect. --- .../ast/DeclareAnnotationDeclaration.java | 106 +++++++------ .../compiler/ast/DeclareDeclaration.java | 145 ++++++++--------- .../compiler/lookup/AjLookupEnvironment.java | 147 +++++++++++------- 3 files changed, 221 insertions(+), 177 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareAnnotationDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareAnnotationDeclaration.java index 2a77cece5..37a015a19 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareAnnotationDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareAnnotationDeclaration.java @@ -24,65 +24,73 @@ import org.aspectj.weaver.patterns.DeclareAnnotation; public class DeclareAnnotationDeclaration extends DeclareDeclaration { - private Annotation annotation; - - public DeclareAnnotationDeclaration(CompilationResult result, DeclareAnnotation symbolicDeclare, Annotation annotation) { - super(result,symbolicDeclare); - this.annotation = annotation; - - addAnnotation(annotation); - if (symbolicDeclare==null) return; // there is an error that will already be getting reported (e.g. incorrect pattern on decaf/decac) - symbolicDeclare.setAnnotationString(annotation.toString()); - - } - - public void analyseCode(ClassScope classScope, - InitializationFlowContext initializationContext, FlowInfo flowInfo) { + private Annotation annotation; + + public DeclareAnnotationDeclaration(CompilationResult result, DeclareAnnotation symbolicDeclare, Annotation annotation) { + super(result, symbolicDeclare); + this.annotation = annotation; + + addAnnotation(annotation); + if (symbolicDeclare == null) { + return; // there is an error that will already be getting reported (e.g. incorrect pattern on decaf/decac) + } + symbolicDeclare.setAnnotationString(annotation.toString()); + + } + + public void analyseCode(ClassScope classScope, InitializationFlowContext initializationContext, FlowInfo flowInfo) { super.analyseCode(classScope, initializationContext, flowInfo); long bits = annotation.resolvedType.getAnnotationTagBits(); - - if ((bits&TagBits.AnnotationTarget)!=0) { - // The annotation is stored against a method. For declare @type we need to - // confirm the annotation targets the right types. Earlier checking will + + if ((bits & TagBits.AnnotationTarget) != 0) { + // The annotation is stored against a method. For declare @type we need to + // confirm the annotation targets the right types. Earlier checking will // have not found this problem because an annotation for target METHOD will // not be reported on as we *do* store it against a method in this case - DeclareAnnotation.Kind k = ((DeclareAnnotation)declareDecl).getKind(); - if (k.equals(DeclareAnnotation.AT_TYPE)) - if ((bits&TagBits.AnnotationForMethod)!=0) - classScope.problemReporter().disallowedTargetForAnnotation(annotation); - if (k.equals(DeclareAnnotation.AT_FIELD)) - if ((bits&TagBits.AnnotationForMethod)!=0) - classScope.problemReporter().disallowedTargetForAnnotation(annotation); + DeclareAnnotation.Kind k = ((DeclareAnnotation) declareDecl).getKind(); + if (k.equals(DeclareAnnotation.AT_TYPE)) { + if ((bits & TagBits.AnnotationForMethod) != 0) { + classScope.problemReporter().disallowedTargetForAnnotation(annotation); + } + } + if (k.equals(DeclareAnnotation.AT_FIELD)) { + if ((bits & TagBits.AnnotationForMethod) != 0) { + classScope.problemReporter().disallowedTargetForAnnotation(annotation); + } + } } - - } - - - public Annotation getDeclaredAnnotation() { - return annotation; - } - + + } + + public Annotation getDeclaredAnnotation() { + return annotation; + } + protected boolean shouldDelegateCodeGeneration() { - return true; // declare annotation needs a method to be written out. + return true; // declare annotation needs a method to be written out. } - - private void addAnnotation(Annotation ann) { - if (this.annotations == null) { - this.annotations = new Annotation[1]; - } else { - Annotation[] old = this.annotations; - this.annotations = new Annotation[old.length + 1]; - System.arraycopy(old,0,this.annotations,1,old.length); - } - this.annotations[0] = ann; - } - + + protected boolean shouldBeSynthetic() { + return false; + } + + private void addAnnotation(Annotation ann) { + if (this.annotations == null) { + this.annotations = new Annotation[1]; + } else { + Annotation[] old = this.annotations; + this.annotations = new Annotation[old.length + 1]; + System.arraycopy(old, 0, this.annotations, 1, old.length); + } + this.annotations[0] = ann; + } + public void postParse(TypeDeclaration typeDec) { super.postParse(typeDec); - if (declareDecl != null){ - ((DeclareAnnotation)declareDecl).setAnnotationMethod(new String(selector)); + if (declareDecl != null) { + ((DeclareAnnotation) declareDecl).setAnnotationMethod(new String(selector)); } } - + } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java index 0c97ce582..e649ec4d2 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java @@ -10,7 +10,6 @@ * PARC initial implementation * ******************************************************************/ - package org.aspectj.ajdt.internal.compiler.ast; //import java.util.List; @@ -47,19 +46,18 @@ public class DeclareDeclaration extends AjMethodDeclaration { */ public DeclareDeclaration(CompilationResult result, Declare symbolicDeclare) { super(result); - + this.declareDecl = symbolicDeclare; if (declareDecl != null) { // AMC added init of declarationSourceXXX fields which are used - // in AsmBuilder for processing of MethodDeclaration locations. + // in AsmBuilder for processing of MethodDeclaration locations. declarationSourceStart = sourceStart = declareDecl.getStart(); declarationSourceEnd = sourceEnd = declareDecl.getEnd(); } - //??? we might need to set parameters to be empty - this.returnType = TypeReference.baseTypeReference(T_void, 0); + // ??? we might need to set parameters to be empty + this.returnType = TypeReference.baseTypeReference(T_void, 0); } - public void addAtAspectJAnnotations() { Annotation annotation = null; if (declareDecl instanceof DeclareAnnotation) { @@ -67,87 +65,93 @@ public class DeclareDeclaration extends AjMethodDeclaration { String patternString = da.getPatternAsString(); String annString = da.getAnnotationString(); String kind = da.getKind().toString(); - annotation = AtAspectJAnnotationFactory.createDeclareAnnAnnotation( - patternString,annString,kind,declarationSourceStart); + annotation = AtAspectJAnnotationFactory.createDeclareAnnAnnotation(patternString, annString, kind, + declarationSourceStart); } else if (declareDecl instanceof DeclareErrorOrWarning) { DeclareErrorOrWarning dd = (DeclareErrorOrWarning) declareDecl; - annotation = AtAspectJAnnotationFactory - .createDeclareErrorOrWarningAnnotation(dd.getPointcut().toString(),dd.getMessage(),dd.isError(),declarationSourceStart); + annotation = AtAspectJAnnotationFactory.createDeclareErrorOrWarningAnnotation(dd.getPointcut().toString(), + dd.getMessage(), dd.isError(), declarationSourceStart); } else if (declareDecl instanceof DeclareParents) { DeclareParents dp = (DeclareParents) declareDecl; String childPattern = dp.getChild().toString(); Collection parentPatterns = dp.getParents().getExactTypes(); StringBuffer parents = new StringBuffer(); for (Iterator iter = parentPatterns.iterator(); iter.hasNext();) { - UnresolvedType urt = ((UnresolvedType) iter.next()); + UnresolvedType urt = ((UnresolvedType) iter.next()); parents.append(urt.getName()); - if (iter.hasNext()) parents.append(", "); - } - annotation = AtAspectJAnnotationFactory - .createDeclareParentsAnnotation(childPattern,parents.toString(),dp.isExtends(),declarationSourceStart); + if (iter.hasNext()) { + parents.append(", "); + } + } + annotation = AtAspectJAnnotationFactory.createDeclareParentsAnnotation(childPattern, parents.toString(), + dp.isExtends(), declarationSourceStart); } else if (declareDecl instanceof DeclarePrecedence) { DeclarePrecedence dp = (DeclarePrecedence) declareDecl; String precedenceList = dp.getPatterns().toString(); - annotation = AtAspectJAnnotationFactory.createDeclarePrecedenceAnnotation(precedenceList,declarationSourceStart); + annotation = AtAspectJAnnotationFactory.createDeclarePrecedenceAnnotation(precedenceList, declarationSourceStart); } else if (declareDecl instanceof DeclareSoft) { DeclareSoft ds = (DeclareSoft) declareDecl; - annotation = AtAspectJAnnotationFactory - .createDeclareSoftAnnotation(ds.getPointcut().toString(),ds.getException().getExactType().getName(),declarationSourceStart); + annotation = AtAspectJAnnotationFactory.createDeclareSoftAnnotation(ds.getPointcut().toString(), ds.getException() + .getExactType().getName(), declarationSourceStart); + } + if (annotation != null) { + AtAspectJAnnotationFactory.addAnnotation(this, annotation, this.scope); } - if (annotation != null) AtAspectJAnnotationFactory.addAnnotation(this,annotation,this.scope); } /** - * A declare declaration exists in a classfile only as an attibute on the - * class. Unlike advice and inter-type declarations, it has no corresponding - * method. - * **AMC** changed the above policy in the case of declare annotation, which uses a - * corresponding method as the anchor for the declared annotation + * A declare declaration exists in a classfile only as an attibute on the class. Unlike advice and inter-type declarations, it + * has no corresponding method. **AMC** changed the above policy in the case of declare annotation, which uses a corresponding + * method as the anchor for the declared annotation */ public void generateCode(ClassScope classScope, ClassFile classFile) { - this.binding.modifiers |= Flags.AccSynthetic; + if (shouldBeSynthetic()) { + this.binding.modifiers |= Flags.AccSynthetic; + } classFile.extraAttributes.add(new EclipseAttributeAdapter(new AjAttribute.DeclareAttribute(declareDecl))); if (shouldDelegateCodeGeneration()) { - super.generateCode(classScope,classFile); + super.generateCode(classScope, classFile); } return; } - + protected boolean shouldDelegateCodeGeneration() { return true; } - public void parseStatements( - Parser parser, - CompilationUnitDeclaration unit) { - // do nothing + protected boolean shouldBeSynthetic() { + return true; + } + + public void parseStatements(Parser parser, CompilationUnitDeclaration unit) { + // do nothing } - + public void resolveStatements(ClassScope upperScope) { - // do nothing + // do nothing } - -// public boolean finishResolveTypes(SourceTypeBinding sourceTypeBinding) { -// // there's nothing for our super to resolve usefully -// //if (!super.finishResolveTypes(sourceTypeBinding)) return false; -//// if (declare == null) return true; -//// -//// EclipseScope scope = new EclipseScope(new FormalBinding[0], this.scope); -//// -//// declare.resolve(scope); -//// return true; -// } - - + + // public boolean finishResolveTypes(SourceTypeBinding sourceTypeBinding) { + // // there's nothing for our super to resolve usefully + // //if (!super.finishResolveTypes(sourceTypeBinding)) return false; + // // if (declare == null) return true; + // // + // // EclipseScope scope = new EclipseScope(new FormalBinding[0], this.scope); + // // + // // declare.resolve(scope); + // // return true; + // } + public Declare build(ClassScope classScope) { - if (declareDecl == null) return null; - - EclipseScope scope = new EclipseScope(new FormalBinding[0], classScope); + if (declareDecl == null) { + return null; + } - declareDecl.resolve(scope); - return declareDecl; - } + EclipseScope scope = new EclipseScope(new FormalBinding[0], classScope); + declareDecl.resolve(scope); + return declareDecl; + } public StringBuffer print(int tab, StringBuffer output) { printIndent(tab, output); @@ -158,32 +162,31 @@ public class DeclareDeclaration extends AjMethodDeclaration { } return output; } - + /** - * We need the ajc$declare method that is created to represent this declare to - * be marked as synthetic + * We need the ajc$declare method that is created to represent this declare to be marked as synthetic */ protected int generateInfoAttributes(ClassFile classFile) { - return super.generateInfoAttributes(classFile,true); + return super.generateInfoAttributes(classFile, true); } public void postParse(TypeDeclaration typeDec) { super.postParse(typeDec); - int declareSequenceNumberInType = ((AspectDeclaration)typeDec).declareCounter++; - //FIXME asc the name should perhaps include the hashcode of the pattern (type/sig) for binary compatibility reasons! + int declareSequenceNumberInType = ((AspectDeclaration) typeDec).declareCounter++; + // FIXME asc the name should perhaps include the hashcode of the pattern (type/sig) for binary compatibility reasons! StringBuffer sb = new StringBuffer(); - sb.append("ajc$declare"); - // Declares can choose to provide a piece of the name - to enable - // them to be easily distinguised at weave time (e.g. see declare annotation) - if (declareDecl!=null) { - String suffix = declareDecl.getNameSuffix(); - if (suffix.length()!=0) { - sb.append("_"); - sb.append(suffix); - } - } - sb.append("_"); - sb.append(declareSequenceNumberInType); - this.selector = sb.toString().toCharArray(); + sb.append("ajc$declare"); + // Declares can choose to provide a piece of the name - to enable + // them to be easily distinguised at weave time (e.g. see declare annotation) + if (declareDecl != null) { + String suffix = declareDecl.getNameSuffix(); + if (suffix.length() != 0) { + sb.append("_"); + sb.append(suffix); + } + } + sb.append("_"); + sb.append(declareSequenceNumberInType); + this.selector = sb.toString().toCharArray(); } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index e38bfdd85..ca37b54ca 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -232,7 +232,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // - weaving that brings new types in for processing (see // pendingTypesToWeave.add() calls) after we thought // we had the full list. - // + // // but these aren't common cases (he bravely said...) boolean typeProcessingOrderIsImportant = declareParents.size() > 0 || declareAnnotationOnTypes.size() > 0; // DECAT @@ -588,7 +588,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC if (!pendingTypesToWeave.contains(sourceType)) { pendingTypesToWeave.add(sourceType); -// inner type ITD support - may need this for some incremental cases... + // inner type ITD support - may need this for some incremental cases... // List ctms = factory.getWorld().getCrosscuttingMembersSet().getTypeMungersOfKind( // ResolvedTypeMunger.InnerClass); // // List innerTypeMungers = new ArrayList(); @@ -633,8 +633,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } } else { - weaveInterTypeDeclarations(sourceType, factory.getTypeMungers(), factory.getDeclareParents(), factory - .getDeclareAnnotationOnTypes(), true); + weaveInterTypeDeclarations(sourceType, factory.getTypeMungers(), factory.getDeclareParents(), + factory.getDeclareAnnotationOnTypes(), true); } } @@ -775,7 +775,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC needOldStyleWarning = false; } onType.addInterTypeMunger(munger, true); - if (munger.getMunger()!=null && munger.getMunger().getKind() == ResolvedTypeMunger.InnerClass) { + if (munger.getMunger() != null && munger.getMunger().getKind() == ResolvedTypeMunger.InnerClass) { // Must do these right now, because if we do an ITD member afterwards it may attempt to reference the // type being applied (the call above 'addInterTypeMunger' will fail for these ITDs if it needed // it to be in place) @@ -791,7 +791,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC onType.checkInterTypeMungers(); for (Iterator i = onType.getInterTypeMungers().iterator(); i.hasNext();) { EclipseTypeMunger munger = (EclipseTypeMunger) i.next(); - if (munger.getMunger()==null || munger.getMunger().getKind() != ResolvedTypeMunger.InnerClass) { + if (munger.getMunger() == null || munger.getMunger().getKind() != ResolvedTypeMunger.InnerClass) { if (munger.munge(sourceType, onType)) { if (factory.pushinCollector != null) { factory.pushinCollector.tagAsMunged(sourceType, munger.getSourceMethod()); @@ -868,8 +868,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC onType.getSourceLocation(), null); } if (Modifier.isFinal(parent.getModifiers())) { - factory.showMessage(IMessage.ERROR, "cannot extend final class " + parent.getClassName(), declareParents - .getSourceLocation(), null); + factory.showMessage(IMessage.ERROR, "cannot extend final class " + parent.getClassName(), + declareParents.getSourceLocation(), null); } else { // do not actually do it if the type isn't exposed - this // will correctly reported as a problem elsewhere @@ -980,44 +980,43 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // Might have to retrieve the annotation through BCEL and construct an // eclipse one for it. if (stb instanceof BinaryTypeBinding) { - ReferenceType rt = (ReferenceType) factory.fromEclipse(stb); - ResolvedMember[] methods = rt.getDeclaredMethods(); - ResolvedMember decaMethod = null; - String nameToLookFor = decA.getAnnotationMethod(); - for (int i = 0; i < methods.length; i++) { - if (methods[i].getName().equals(nameToLookFor)) { - decaMethod = methods[i]; - break; - } - } - if (decaMethod != null) { // could assert this ... - AnnotationAJ[] axs = decaMethod.getAnnotations(); - if (axs != null) { // another error has occurred, dont crash here because of it - toAdd = new Annotation[1]; - toAdd[0] = createAnnotationFromBcelAnnotation(axs[0], decaMethod.getSourceLocation().getOffset(), factory); - // BUG BUG BUG - We dont test these abits are correct, in fact - // we'll be very lucky if they are. - // What does that mean? It means on an incremental compile you - // might get away with an - // annotation that isn't allowed on a type being put on a type. - if (toAdd[0].resolvedType != null) { - abits = toAdd[0].resolvedType.getAnnotationTagBits(); - } - } + toAdd = retrieveAnnotationFromBinaryTypeBinding(decA, stb); + if (toAdd != null && toAdd.length > 0 && toAdd[0].resolvedType != null) { + abits = toAdd[0].resolvedType.getAnnotationTagBits(); } } else if (stb != null) { // much nicer, its a real SourceTypeBinding so we can stay in // eclipse land // if (decA.getAnnotationMethod() != null) { - MethodBinding[] mbs = stb.getMethods(decA.getAnnotationMethod().toCharArray()); - abits = mbs[0].getAnnotationTagBits(); // ensure resolved - TypeDeclaration typeDecl = ((SourceTypeBinding) mbs[0].declaringClass).scope.referenceContext; - methodDecl = typeDecl.declarationOf(mbs[0]); - toAdd = methodDecl.annotations; // this is what to add - toAdd[0] = createAnnotationCopy(toAdd[0]); - if (toAdd[0].resolvedType != null) { - abits = toAdd[0].resolvedType.getAnnotationTagBits(); - // } + char[] declareSelector = decA.getAnnotationMethod().toCharArray(); + + ReferenceBinding rb = stb; + String declaringAspectName = decA.getDeclaringType().getRawName(); + while (rb != null && !new String(CharOperation.concatWith(rb.compoundName, '.')).equals(declaringAspectName)) { + rb = rb.superclass(); + } + MethodBinding[] mbs = rb.getMethods(declareSelector); + + ReferenceBinding declaringBinding = mbs[0].declaringClass; + if (declaringBinding instanceof ParameterizedTypeBinding) { + // Unwrap - this means we don't allow the type of the annotation to be parameterized, may need to revisit that + declaringBinding = ((ParameterizedTypeBinding) declaringBinding).type; + } + if (declaringBinding instanceof BinaryTypeBinding) { + toAdd = retrieveAnnotationFromBinaryTypeBinding(decA, declaringBinding); + if (toAdd != null && toAdd.length > 0 && toAdd[0].resolvedType != null) { + abits = toAdd[0].resolvedType.getAnnotationTagBits(); + } + } else { + abits = mbs[0].getAnnotationTagBits(); // ensure resolved + TypeDeclaration typeDecl = ((SourceTypeBinding) declaringBinding).scope.referenceContext; + methodDecl = typeDecl.declarationOf(mbs[0]); + toAdd = methodDecl.annotations; // this is what to add + toAdd[0] = createAnnotationCopy(toAdd[0]); + if (toAdd[0].resolvedType != null) { + abits = toAdd[0].resolvedType.getAnnotationTagBits(); + // } + } } } @@ -1163,6 +1162,36 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC return true; } + private Annotation[] retrieveAnnotationFromBinaryTypeBinding(DeclareAnnotation decA, ReferenceBinding declaringBinding) { + ReferenceType rt = (ReferenceType) factory.fromEclipse(declaringBinding); + ResolvedMember[] methods = rt.getDeclaredMethods(); + ResolvedMember decaMethod = null; + String nameToLookFor = decA.getAnnotationMethod(); + for (int i = 0; i < methods.length; i++) { + if (methods[i].getName().equals(nameToLookFor)) { + decaMethod = methods[i]; + break; + } + } + if (decaMethod != null) { // could assert this ... + AnnotationAJ[] axs = decaMethod.getAnnotations(); + if (axs != null) { // another error has occurred, dont crash here because of it + Annotation[] toAdd = new Annotation[1]; + toAdd[0] = createAnnotationFromBcelAnnotation(axs[0], decaMethod.getSourceLocation().getOffset(), factory); + // BUG BUG BUG - We dont test these abits are correct, in fact + // we'll be very lucky if they are. + // What does that mean? It means on an incremental compile you + // might get away with an + // annotation that isn't allowed on a type being put on a type. + // if (toAdd[0].resolvedType != null) { + // abits = toAdd[0].resolvedType.getAnnotationTagBits(); + // } + return toAdd; + } + } + return null; + } + /** * Transform an annotation from its AJ form to an eclipse form. We *DONT* care about the values of the annotation. that is * because it is only being stuck on a type during type completion to allow for other constructs (decps, decas) that might be @@ -1244,9 +1273,13 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } filename = filename.substring(takefrom + 1); - factory.getWorld().getMessageHandler().handleMessage( - WeaveMessage.constructWeavingMessage(wmk, new String[] { CharOperation.toString(sourceType.compoundName), - filename, parent.getClassName(), getShortname(parent.getSourceLocation().getSourceFile().getPath()) })); + factory.getWorld() + .getMessageHandler() + .handleMessage( + WeaveMessage.constructWeavingMessage(wmk, + new String[] { CharOperation.toString(sourceType.compoundName), filename, + parent.getClassName(), + getShortname(parent.getSourceLocation().getSourceFile().getPath()) })); } } @@ -1389,7 +1422,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // System.err.println("Looking for anything that might match "+element+" on "+ // sourceType.debugName()+" "+getType(sourceType. // compoundName).debugName()+" "+(sourceType instanceof BinaryTypeBinding)); -// +// // ReferenceBinding rbb = getType(sourceType.compoundName); // // fix me if we ever uncomment this code... should iterate the other way // round, over the methods then over the decas @@ -1401,17 +1434,17 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // ((SourceTypeBinding)rbb).getExactMethod(sourceMb.selector // ,sourceMb.parameters); // boolean isCtor = sourceMb.selector[0]=='<'; -// +// // if ((element.isDeclareAtConstuctor() ^ !isCtor)) { // System.err.println("Checking "+sourceMb+" ... declaringclass="+sourceMb. // declaringClass.debugName()+" rbb="+rbb.debugName()+" "+ // sourceMb.declaringClass.equals(rbb)); -// +// // ResolvedMember rm = null; // rm = EclipseFactory.makeResolvedMember(mbbbb); // if (element.matches(rm,factory.getWorld())) { // System.err.println("MATCH"); -// +// // // Determine the set of annotations that are currently on the method // ReferenceBinding rb = getType(sourceType.compoundName); // // TypeBinding tb = factory.makeTypeBinding(decA.getAspect()); @@ -1424,7 +1457,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(sourceMb); // Annotation[] currentlyHas = methodDecl.annotations; // this is what to add // //abits = toAdd[0].resolvedType.getAnnotationTagBits(); -// +// // // Determine the annotations to add to that method // TypeBinding tb = factory.makeTypeBinding(element.getAspect()); // MethodBinding[] aspectMbs = @@ -1438,7 +1471,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // Annotation[] toAdd = methodDecl2.annotations; // this is what to add // // abits = toAdd[0].resolvedType.getAnnotationTagBits(); // System.err.println("Has: "+currentlyHas+" toAdd: "+toAdd); -// +// // // fix me? should check if it already has the annotation // //Annotation abefore[] = sourceType.scope.referenceContext.annotations; // Annotation[] newset = new @@ -1473,7 +1506,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // System.err.println("Processing deca "+element+" on "+sourceType.debugName()+ // " "+getType(sourceType.compoundName).debugName()+" " // +(sourceType instanceof BinaryTypeBinding)); -// +// // ReferenceBinding rbb = getType(sourceType.compoundName); // // fix me? should iterate the other way round, over the methods then over the // decas @@ -1484,15 +1517,15 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // //FieldBinding fbbbb = // ((SourceTypeBinding)rbb).getgetExactMethod(sourceMb.selector // ,sourceMb.parameters); -// +// // System.err.println("Checking "+sourceFb+" ... declaringclass="+sourceFb. // declaringClass.debugName()+" rbb="+rbb.debugName()); -// +// // ResolvedMember rm = null; // rm = EclipseFactory.makeResolvedMember(sourceFb); // if (element.matches(rm,factory.getWorld())) { // System.err.println("MATCH"); -// +// // // Determine the set of annotations that are currently on the field // ReferenceBinding rb = getType(sourceType.compoundName); // // TypeBinding tb = factory.makeTypeBinding(decA.getAspect()); @@ -1504,7 +1537,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // //AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(sourceMb); // Annotation[] currentlyHas = fd.annotations; // this is what to add // //abits = toAdd[0].resolvedType.getAnnotationTagBits(); -// +// // // Determine the annotations to add to that method // TypeBinding tb = factory.makeTypeBinding(element.getAspect()); // MethodBinding[] aspectMbs = @@ -1518,7 +1551,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // Annotation[] toAdd = methodDecl2.annotations; // this is what to add // // abits = toAdd[0].resolvedType.getAnnotationTagBits(); // System.err.println("Has: "+currentlyHas+" toAdd: "+toAdd); -// +// // // fix me? check if it already has the annotation // // @@ -1535,6 +1568,6 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // } else // System.err.println("NO MATCH"); // } -// +// // } // } -- 2.39.5