From 9c38e399f5d9c75fdd2b918752fba7fa12b28673 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 20 Jan 2006 09:40:54 +0000 Subject: 77166 - newarray joinpoint support. "-Xjoinpoints:arrayconstruction" --- .../aspectj/weaver/JoinPointSignatureIterator.java | 10 ++++ weaver/src/org/aspectj/weaver/Shadow.java | 22 ++++++++ weaver/src/org/aspectj/weaver/World.java | 1 + .../org/aspectj/weaver/bcel/BcelClassWeaver.java | 38 +++++++++++++- weaver/src/org/aspectj/weaver/bcel/BcelShadow.java | 61 +++++++++++++++++++--- .../org/aspectj/weaver/patterns/ArgsPointcut.java | 7 ++- 6 files changed, 130 insertions(+), 9 deletions(-) (limited to 'weaver') diff --git a/weaver/src/org/aspectj/weaver/JoinPointSignatureIterator.java b/weaver/src/org/aspectj/weaver/JoinPointSignatureIterator.java index b11f41f80..265f6f4e0 100644 --- a/weaver/src/org/aspectj/weaver/JoinPointSignatureIterator.java +++ b/weaver/src/org/aspectj/weaver/JoinPointSignatureIterator.java @@ -96,7 +96,17 @@ public class JoinPointSignatureIterator implements Iterator { // Walk up hierarchy creating one member for each type up to and including the // first defining type ResolvedType originalDeclaringType = signaturesOfMember.getDeclaringType().resolve(world); + + if (world.isJoinpointArrayConstructionEnabled() && originalDeclaringType.isArray()) { // Aha, this must be the array constructor call join point - a 'special'... + Member m = signaturesOfMember; + ResolvedMember rm = new ResolvedMemberImpl(m.getKind(),m.getDeclaringType(),m.getModifiers(),m.getReturnType(),m.getName(),m.getParameterTypes()); + discoveredSignatures.add(new JoinPointSignature(rm,originalDeclaringType)); + couldBeFurtherAsYetUndiscoveredSignatures = false; + return; + } + firstDefiningMember = (ResolvedMemberImpl) signaturesOfMember.resolve(world); + if (firstDefiningMember == null) { couldBeFurtherAsYetUndiscoveredSignatures = false; return; diff --git a/weaver/src/org/aspectj/weaver/Shadow.java b/weaver/src/org/aspectj/weaver/Shadow.java index 4d28fbe59..ab652b24c 100644 --- a/weaver/src/org/aspectj/weaver/Shadow.java +++ b/weaver/src/org/aspectj/weaver/Shadow.java @@ -142,7 +142,29 @@ public abstract class Shadow { return getSignature().getParameterTypes(); } + public boolean isShadowForArrayConstructionJoinpoint() { + return (getKind()==ConstructorCall && signature.getDeclaringType().isArray()); + } + + // will return the right length array of ints depending on how many dimensions the array has + public ResolvedType[] getArgumentTypesForArrayConstructionShadow() { + String s = signature.getDeclaringType().getSignature(); + int pos = s.indexOf("["); + int dims = 1; + while (pos