From e8ce7c29343baed3b22173ec76a23e852ffbd12e Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 30 Jan 2006 10:27:20 +0000 Subject: [PATCH] enh 123423 (expose PTW type) - code currently commented out until return type of getWithinType() decided... --- .../internal/compiler/ast/AspectDeclaration.java | 14 +++++++++++++- weaver/src/org/aspectj/weaver/AjcMemberMaker.java | 11 +++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java index 87dc14868..45c710cb3 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java @@ -75,6 +75,7 @@ public class AspectDeclaration extends TypeDeclaration { private AjAttribute.Aspect aspectAttribute; public PerClause perClause; public ResolvedMember aspectOfMethod; + //public ResolvedMember ptwGetWithinTypeMethod; public ResolvedMember hasAspectMethod; @@ -369,7 +370,7 @@ public class AspectDeclaration extends TypeDeclaration { generatePerTypeWithinHasAspectMethod(classFile); generatePerTypeWithinCreateAspectInstanceMethod(classFile); // generate public static X ajc$createAspectInstance(Class forClass) { // PTWIMPL getWithinType() would need this... - // generatePerTypeWithinGetWithinTypeMethod(classFile); // generate public Class getWithinType() { + //generatePerTypeWithinGetWithinTypeMethod(classFile); // generate public Class getWithinType() { } else { throw new RuntimeException("unimplemented"); } @@ -547,6 +548,15 @@ public class AspectDeclaration extends TypeDeclaration { return interfaceType; } + /*private void generatePerTypeWithinGetWithinTypeMethod(ClassFile classFile) { + final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope); + generateMethod(classFile,ptwGetWithinTypeMethod,new BodyGenerator() { + public void generate(CodeStream codeStream) { + codeStream.aload_0(); + codeStream.getfield(world.makeFieldBinding(AjcMemberMaker.perTypeWithinWithinTypeField(typeX,typeX))); + codeStream.areturn(); + }}); + }*/ // PTWIMPL Generate aspectOf() method private void generatePerTypeWithinAspectOfMethod(ClassFile classFile) { @@ -1030,6 +1040,8 @@ public class AspectDeclaration extends TypeDeclaration { // PTWIMPL Use these variants of aspectOf()/hasAspect() aspectOfMethod = AjcMemberMaker.perTypeWithinAspectOfMethod(typeX,world.getWorld().isInJava5Mode()); hasAspectMethod = AjcMemberMaker.perTypeWithinHasAspectMethod(typeX,world.getWorld().isInJava5Mode()); + //ptwGetWithinTypeMethod = AjcMemberMaker.perTypeWithinGetWithinTypeMethod(typeX,world.getWorld().isInJava5Mode()); + //binding.addMethod(world.makeMethodBinding(ptwGetWithinTypeMethod)); } else { throw new RuntimeException("bad per clause: " + perClause); } diff --git a/weaver/src/org/aspectj/weaver/AjcMemberMaker.java b/weaver/src/org/aspectj/weaver/AjcMemberMaker.java index a0add374c..3b6e350b3 100644 --- a/weaver/src/org/aspectj/weaver/AjcMemberMaker.java +++ b/weaver/src/org/aspectj/weaver/AjcMemberMaker.java @@ -290,6 +290,17 @@ public class AjcMemberMaker { // "(Ljava/lang/Class;)" + declaringType.getSignature()); } + + /*public static ResolvedMember perTypeWithinGetWithinTypeMethod(UnresolvedType declaringType, boolean inJava5Mode) { + UnresolvedType returnType = null; + if (inJava5Mode) { + returnType = UnresolvedType.forRawTypeName("java.lang.Class"); + } else { + returnType = UnresolvedType.forSignature("Ljava/lang/Class;"); + } + return new ResolvedMemberImpl(Member.METHOD,declaringType,Modifier.PUBLIC,ResolvedType.JAVA_LANG_STRING,"getWithinType",new UnresolvedType[]{}); + }*/ + // PTWIMPL ResolvedMember for hasAspect(), declared in aspect public static ResolvedMember perTypeWithinHasAspectMethod(UnresolvedType declaringType, boolean inJava5Mode) { UnresolvedType parameterType = null; -- 2.39.5