diff options
author | aclement <aclement> | 2004-08-11 12:24:27 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-08-11 12:24:27 +0000 |
commit | 64183c38266114bce7aa60ff743b4b9eda5cbe2d (patch) | |
tree | 4b4b805e6199b1d8817cfbf0f592fe9adadba7ba /org.aspectj.ajdt.core | |
parent | 065228643beb192e3214a032c2b62f90db4f8592 (diff) | |
download | aspectj-64183c38266114bce7aa60ff743b4b9eda5cbe2d.tar.gz aspectj-64183c38266114bce7aa60ff743b4b9eda5cbe2d.zip |
Fix and tests for Bugzilla Bug 68991
intertype initialisers should match field set pointcuts
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java index 2c45f3d1a..cbfbc0c04 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java @@ -99,12 +99,23 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration { new ReturnStatement(null, 0, 0), }; } else if (!onTypeBinding.isInterface()) { - FieldBinding interField = world.makeFieldBinding( - AjcMemberMaker.interFieldClassField(sig, aspectType)); - Reference ref = new KnownFieldReference(interField, 0); - this.statements = new Statement[] { - new Assignment(ref, initialization, initialization.sourceEnd), - }; + MethodBinding writeMethod = world.makeMethodBinding( + AjcMemberMaker.interFieldSetDispatcher(sig,aspectType)); + // For the body of an intertype field initalizer, generate a call to the inter field set dispatcher + // method as that casts the shadow of a field set join point. + if (Modifier.isStatic(declaredModifiers)) { + this.statements = new Statement[] { + new KnownMessageSend(writeMethod, + AstUtil.makeNameReference(writeMethod.declaringClass), + new Expression[] {initialization}), + }; + } else { + this.statements = new Statement[] { + new KnownMessageSend(writeMethod, + AstUtil.makeNameReference(writeMethod.declaringClass), + new Expression[] {AstUtil.makeLocalVariableReference(arguments[0].binding),initialization}), + }; + } } else { //XXX something is broken about this logic. Can we write to static interface fields? MethodBinding writeMethod = world.makeMethodBinding( |