diff options
author | jhugunin <jhugunin> | 2003-01-21 23:57:49 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-01-21 23:57:49 +0000 |
commit | 5e510183142837a16fbea87129a3d6203072d59c (patch) | |
tree | ec08275e7c0392486eea37e7fb9452cf3a54624e /weaver/src | |
parent | 094b548830a6e69c01215eb3775ced1632d6fa56 (diff) | |
download | aspectj-5e510183142837a16fbea87129a3d6203072d59c.tar.gz aspectj-5e510183142837a16fbea87129a3d6203072d59c.zip |
redesign of making members used in around bodies accessible
this design is confiined to the aspect containing the around entirely which
makes for cleaner implementation issues and lets things like super calls
be implemented correctly.
Diffstat (limited to 'weaver/src')
-rw-r--r-- | weaver/src/org/aspectj/weaver/AjcMemberMaker.java | 61 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/NameMangler.java | 17 |
2 files changed, 78 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/AjcMemberMaker.java b/weaver/src/org/aspectj/weaver/AjcMemberMaker.java index dbb002d2b..2a63a6e5e 100644 --- a/weaver/src/org/aspectj/weaver/AjcMemberMaker.java +++ b/weaver/src/org/aspectj/weaver/AjcMemberMaker.java @@ -215,7 +215,68 @@ public class AjcMemberMaker { sig); } + // --- inline accessors + //??? can eclipse handle a transform this weird without putting synthetics into the mix + public static ResolvedMember superAccessMethod(TypeX baseType, ResolvedMember method) { + return new ResolvedMember(Member.METHOD, + baseType, + Modifier.PUBLIC, + method.getReturnType(), + NameMangler.superDispatchMethod(baseType, method.getName()), + method.getParameterTypes()); + //XXX needs thrown exceptions to be correct + } + public static ResolvedMember inlineAccessMethodForMethod(TypeX aspectType, ResolvedMember method) { + TypeX[] paramTypes = method.getParameterTypes(); + if (!method.isStatic()) { + paramTypes = TypeX.insert(method.getDeclaringType(), paramTypes); + } + return new ResolvedMember(Member.METHOD, + aspectType, + PUBLIC_STATIC, //??? what about privileged and super access + //???Modifier.PUBLIC | (method.isStatic() ? Modifier.STATIC : 0), + method.getReturnType(), + + NameMangler.inlineAccessMethodForMethod(method.getName(), + method.getDeclaringType(), aspectType), + paramTypes); + //XXX needs thrown exceptions to be correct + } + + public static ResolvedMember inlineAccessMethodForFieldGet(TypeX aspectType, Member field) { + String sig; + if (field.isStatic()) { + sig = "()" + field.getReturnType().getSignature(); + } else { + sig = "(" + field.getDeclaringType().getSignature() + ")" + field.getReturnType().getSignature(); + } + + return new ResolvedMember(Member.METHOD, + aspectType, + PUBLIC_STATIC, //Modifier.PUBLIC | (field.isStatic() ? Modifier.STATIC : 0), + NameMangler.inlineAccessMethodForFieldGet(field.getName(), + field.getDeclaringType(), aspectType), + sig); + } + + public static ResolvedMember inlineAccessMethodForFieldSet(TypeX aspectType, Member field) { + String sig; + if (field.isStatic()) { + sig = "(" + field.getReturnType().getSignature() + ")V"; + } else { + sig = "(" + field.getDeclaringType().getSignature() + field.getReturnType().getSignature() + ")V"; + } + + return new ResolvedMember(Member.METHOD, + aspectType, + PUBLIC_STATIC, //Modifier.PUBLIC | (field.isStatic() ? Modifier.STATIC : 0), + NameMangler.inlineAccessMethodForFieldSet(field.getName(), + field.getDeclaringType(), aspectType), + sig); + } + + // --- runtimeLibrary api stuff diff --git a/weaver/src/org/aspectj/weaver/NameMangler.java b/weaver/src/org/aspectj/weaver/NameMangler.java index d967aa110..f3a9e4c28 100644 --- a/weaver/src/org/aspectj/weaver/NameMangler.java +++ b/weaver/src/org/aspectj/weaver/NameMangler.java @@ -74,6 +74,23 @@ public class NameMangler { + public static String inlineAccessMethodForMethod(String name, TypeX objectType, TypeX aspectType) { + return makeName("inlineAccessMethod", aspectType.getNameAsIdentifier(), + objectType.getNameAsIdentifier(), name); + } + + public static String inlineAccessMethodForFieldGet(String name, TypeX objectType, TypeX aspectType) { + return makeName("inlineAccessFieldGet", aspectType.getNameAsIdentifier(), + objectType.getNameAsIdentifier(), name); + } + + public static String inlineAccessMethodForFieldSet(String name, TypeX objectType, TypeX aspectType) { + return makeName("inlineAccessFieldSet", aspectType.getNameAsIdentifier(), + objectType.getNameAsIdentifier(), name); + } + + + /** * The name of methods corresponding to advice declarations */ |