summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core/src
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-12 10:04:51 +0000
committeracolyer <acolyer>2005-09-12 10:04:51 +0000
commitf5030e64039e19f562423d9c8b7f7b4587ecdea7 (patch)
treed8b0a8a4fafb47a0ac90dc4a5dd50a644a821adb /org.aspectj.ajdt.core/src
parent64d74013c685a815cbe3565f71747103177daf20 (diff)
downloadaspectj-f5030e64039e19f562423d9c8b7f7b4587ecdea7.tar.gz
aspectj-f5030e64039e19f562423d9c8b7f7b4587ecdea7.zip
tests and fix for pr108903 - MUST process from super aspect to sub aspect when finding declares
Diffstat (limited to 'org.aspectj.ajdt.core/src')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java42
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java1
2 files changed, 34 insertions, 9 deletions
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 f157dbbda..4b4ada030 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
@@ -122,14 +122,22 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
AnonymousClassPublisher.aspectOf().setAnonymousClassCreationListener(this);
// need to build inter-type declarations for all AspectDeclarations at this point
- for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
- SourceTypeBinding[] b = units[i].scope.topLevelTypes;
- for (int j = 0; j < b.length; j++) {
- buildInterTypeAndPerClause(b[j].scope);
- addCrosscuttingStructures(b[j].scope);
- }
- }
+ // this MUST be done in order from super-types to subtypes
+ List typesToProcess = new ArrayList();
+ for (int i=lastCompletedUnitIndex+1; i<=lastUnitIndex; i++) {
+ CompilationUnitScope cus = units[i].scope;
+ SourceTypeBinding[] stbs = cus.topLevelTypes;
+ for (int j=0; j<stbs.length; j++) {
+ SourceTypeBinding stb = stbs[j];
+ typesToProcess.add(stb);
+ }
+ }
+ while (typesToProcess.size()>0) {
+ // removes types from the list as they are processed...
+ collectAllITDsAndDeclares((SourceTypeBinding)typesToProcess.get(0),typesToProcess);
+ }
+
factory.finishTypeMungers();
// now do weaving
@@ -156,7 +164,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
boolean typeProcessingOrderIsImportant = declareParents.size()>0 || declareAnnotationOnTypes.size()>0; //DECAT
if (typeProcessingOrderIsImportant) {
- List typesToProcess = new ArrayList();
+ typesToProcess = new ArrayList();
for (int i=lastCompletedUnitIndex+1; i<=lastUnitIndex; i++) {
CompilationUnitScope cus = units[i].scope;
SourceTypeBinding[] stbs = cus.topLevelTypes;
@@ -201,6 +209,24 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
lastCompletedUnitIndex = lastUnitIndex;
}
+
+ /**
+ * Find all the ITDs and Declares, but it is important we do this from the supertypes
+ * down to the subtypes.
+ * @param sourceType
+ * @param yetToProcess
+ */
+ private void collectAllITDsAndDeclares(SourceTypeBinding sourceType, Collection yetToProcess) {
+ // Look at the supertype first
+ ReferenceBinding superType = sourceType.superclass();
+ if (yetToProcess.contains(superType) && superType instanceof SourceTypeBinding) {
+ collectAllITDsAndDeclares((SourceTypeBinding)superType, yetToProcess);
+ }
+ buildInterTypeAndPerClause(sourceType.scope);
+ addCrosscuttingStructures(sourceType.scope);
+ yetToProcess.remove(sourceType);
+ }
+
/**
* Weave the parents and intertype decls into a given type. This method looks at the
* supertype and superinterfaces for the specified type and recurses to weave those first
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
index 406542ec1..e95c78233 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
@@ -27,7 +27,6 @@ import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
-import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;