diff options
author | acolyer <acolyer> | 2005-08-11 14:59:14 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-08-11 14:59:14 +0000 |
commit | c8f96a7768dba1d8c707b24c8cc15e641a9e868f (patch) | |
tree | d7b8957cb23f47aa77fc000ac066d6c5ae870bc9 | |
parent | 987ad67ea188a8521ff9178eaf5d6c996b9afa36 (diff) | |
download | aspectj-c8f96a7768dba1d8c707b24c8cc15e641a9e868f.tar.gz aspectj-c8f96a7768dba1d8c707b24c8cc15e641a9e868f.zip |
only collect declares from concrete aspects
-rw-r--r-- | weaver/src/org/aspectj/weaver/ResolvedType.java | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/weaver/src/org/aspectj/weaver/ResolvedType.java b/weaver/src/org/aspectj/weaver/ResolvedType.java index 185c1d9fe..8e359fcdc 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedType.java +++ b/weaver/src/org/aspectj/weaver/ResolvedType.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -459,12 +460,12 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl ArrayList ret = new ArrayList(); //if (this.isAbstract()) { - for (Iterator i = getDeclares().iterator(); i.hasNext();) { - Declare dec = (Declare) i.next(); - if (!dec.isAdviceLike()) ret.add(dec); - } - - if (!includeAdviceLike) return ret; +// for (Iterator i = getDeclares().iterator(); i.hasNext();) { +// Declare dec = (Declare) i.next(); +// if (!dec.isAdviceLike()) ret.add(dec); +// } +// +// if (!includeAdviceLike) return ret; if (!this.isAbstract()) { //ret.addAll(getDeclares()); @@ -483,7 +484,11 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl //System.out.println("super: " + ty + ", " + ); for (Iterator i = ty.getDeclares().iterator(); i.hasNext();) { Declare dec = (Declare) i.next(); - if (dec.isAdviceLike()) ret.add(dec); + if (dec.isAdviceLike()) { + if (includeAdviceLike) ret.add(dec); + } else { + ret.add(dec); + } } } } @@ -596,30 +601,39 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Modifier.isFinal(getModifiers()); } + protected Map /*Type variable name -> UnresolvedType*/ getMemberParameterizationMap() { + if (!isParameterizedType()) return Collections.EMPTY_MAP; + TypeVariable[] tvs = getGenericType().getTypeVariables(); + Map parameterizationMap = new HashMap(); + for (int i = 0; i < tvs.length; i++) { + parameterizationMap.put(tvs[i].getName(), typeParameters[i]); + } + return parameterizationMap; + } + + public Collection getDeclaredAdvice() { List l = new ArrayList(); ResolvedMember[] methods = getDeclaredMethods(); + if (isParameterizedType()) methods = getGenericType().getDeclaredMethods(); + Map typeVariableMap = getMemberParameterizationMap(); for (int i=0, len = methods.length; i < len; i++) { ShadowMunger munger = methods[i].getAssociatedShadowMunger(); - if (munger != null) l.add(munger); + if (munger != null) { + if (this.isParameterizedType()) { + munger.setPointcut(munger.getPointcut().parameterizeWith(typeVariableMap)); + } + l.add(munger); + } } return l; } - private List shadowMungers = new ArrayList(0); - public Collection getDeclaredShadowMungers() { Collection c = getDeclaredAdvice(); - c.addAll(shadowMungers); return c; } - - public void addShadowMunger(ShadowMunger munger) { - shadowMungers.add(munger); - } - - // ---- only for testing! |