diff options
author | jhugunin <jhugunin> | 2003-09-12 16:49:58 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-09-12 16:49:58 +0000 |
commit | b5127388a3b5a2403e8d8944766bbe1895e09530 (patch) | |
tree | 1bc69df69075a48d0180b21e080f4c9f7bcaf9da /org.aspectj.ajdt.core | |
parent | 3b79af95c2373158d6b4149476746e880866e385 (diff) | |
download | aspectj-b5127388a3b5a2403e8d8944766bbe1895e09530.tar.gz aspectj-b5127388a3b5a2403e8d8944766bbe1895e09530.zip |
fix and test for Bugzilla Bug 42993
Language regression, or possible language improvement?
The problem was caused by moving name binding in pointcut declarations to
happen before declare parents are evaluated. Because of this, the
compiler doesn't know that ContainerDescriptor isa Key when resolving
the ContainerLoader.containerLoads reference.
The change in ordering was made to fix a bug reported in declare error
and declare soft whose pcds where being evaluated before name binding
had happened in the pointcut declarations. Unfortunately, declare error
and declare soft are concretized at the same time as declare parents
(and all other declares ;-), so this move also led to the regression
noted above.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java | 49 |
1 files changed, 35 insertions, 14 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 4f9badc83..711eb25fc 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 @@ -92,21 +92,10 @@ public class AjLookupEnvironment extends LookupEnvironment { SourceTypeBinding[] b = units[i].scope.topLevelTypes; for (int j = 0; j < b.length; j++) { buildInterTypeAndPerClause(b[j].scope); - } - } - for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { - SourceTypeBinding[] b = units[i].scope.topLevelTypes; - for (int j = 0; j < b.length; j++) { - resolvePointcutDeclarations(b[j].scope); - } - } - - for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { - SourceTypeBinding[] b = units[i].scope.topLevelTypes; - for (int j = 0; j < b.length; j++) { addCrosscuttingStructures(b[j].scope); } - } + } + factory.finishTypeMungers(); // now do weaving @@ -118,8 +107,25 @@ public class AjLookupEnvironment extends LookupEnvironment { for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { weaveInterTypeDeclarations(units[i].scope, typeMungers, declareParents); - units[i] = null; // release unnecessary reference to the parsed unit } + + for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { + SourceTypeBinding[] b = units[i].scope.topLevelTypes; + for (int j = 0; j < b.length; j++) { + resolvePointcutDeclarations(b[j].scope); + } + } + + for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { + SourceTypeBinding[] b = units[i].scope.topLevelTypes; + for (int j = 0; j < b.length; j++) { + addAdviceLikeDeclares(b[j].scope); + } + } + + for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { + units[i] = null; // release unnecessary reference to the parsed unit + } stepCompleted = BUILD_FIELDS_AND_METHODS; lastCompletedUnitIndex = lastUnitIndex; @@ -132,6 +138,21 @@ public class AjLookupEnvironment extends LookupEnvironment { } pendingTypesToWeave.clear(); } + + private void addAdviceLikeDeclares(ClassScope s) { + TypeDeclaration dec = s.referenceContext; + + if (dec instanceof AspectDeclaration) { + ResolvedTypeX typeX = factory.fromEclipse(dec.binding); + factory.getWorld().getCrosscuttingMembersSet().addAdviceLikeDeclares(typeX); + } + + SourceTypeBinding sourceType = s.referenceContext.binding; + ReferenceBinding[] memberTypes = sourceType.memberTypes; + for (int i = 0, length = memberTypes.length; i < length; i++) { + addCrosscuttingStructures(((SourceTypeBinding) memberTypes[i]).scope); + } + } private void addCrosscuttingStructures(ClassScope s) { TypeDeclaration dec = s.referenceContext; |