diff options
author | aclement <aclement> | 2006-10-24 12:42:57 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-10-24 12:42:57 +0000 |
commit | 7b40e7e3e4b68d6b0334f5643931e00f06881cdd (patch) | |
tree | 55220f868d7a27c45383ea4980ec8ca7a179cd2d | |
parent | 70dda814951a9cf2f79e958b2bd93f66f390b6da (diff) | |
download | aspectj-7b40e7e3e4b68d6b0334f5643931e00f06881cdd.tar.gz aspectj-7b40e7e3e4b68d6b0334f5643931e00f06881cdd.zip |
tests and fixes for 161502: annotation style generic pointcuts (!)
64 files changed, 303 insertions, 140 deletions
diff --git a/tests/bugs153/pr161502/Main.java b/tests/bugs153/pr161502/Main.java new file mode 100644 index 000000000..81a1eae09 --- /dev/null +++ b/tests/bugs153/pr161502/Main.java @@ -0,0 +1,34 @@ +import java.util.ArrayList; +import java.util.List; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +public class Main { + + public List<? extends Element> getElements() { + return new ArrayList<Element>(); + } + + class Element {}; + + @Aspect + static abstract class Base<T> { + @Around("call(List<? extends T> *.*(..))") + public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) { + try { + return (List<? extends T>)thisJoinPoint.proceed(); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + } + + @Aspect + static class Concrete extends Base<Element> {} + + public static void main(String[] args) { + new Main().getElements(); + } + +}
\ No newline at end of file diff --git a/tests/bugs153/pr161502/Main2.java b/tests/bugs153/pr161502/Main2.java new file mode 100644 index 000000000..b87503b28 --- /dev/null +++ b/tests/bugs153/pr161502/Main2.java @@ -0,0 +1,34 @@ +import java.util.ArrayList; +import java.util.List; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +public class Main2 { + + public List<? extends Element> getElements() { + return new ArrayList<Element>(); + } + + class Element {}; + + @Aspect + static abstract class Base<T> { + @Around("call(List<? extends T> *.*(..))") + public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) { + try { + return (List<? extends T>)thisJoinPoint.proceed(); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + } + + @Aspect + static class Concrete extends Base<String> {} // pointcut won't match because not a call to "List<? extends String> *(..)" + + public static void main(String[] args) { + new Main2().getElements(); + } + +}
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 503eccbe8..1ca3b4b59 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -4563,21 +4563,21 @@ <compile files="GenericAspectY.aj" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectY.aj:53) advised by before advice from 'GenericAspectY' (GenericAspectY.aj:101) [with runtime test]"/> <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectY.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectY.aj)"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> - <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> - <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectY.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectY.aj)"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> </compile> <run class="GenericAspectY"/> </ajc-test> @@ -4585,7 +4585,25 @@ <compile files="GenericAspectZ.aj" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:53) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:95) [with runtime test]"/> <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.removeChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:65) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:96) [with runtime test]"/> + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + + <!--message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> @@ -4600,7 +4618,7 @@ <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> - <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/--> </compile> <run class="GenericAspectZ"/> </ajc-test> @@ -4781,7 +4799,7 @@ <compile files="A2.aj" inpath="code.jar" options="-1.5,-showWeaveInfo"> <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/> - <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<Z> BaseClass.list2')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<N> BaseClass.list2')"/> <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/> </compile> <run class="BaseClass"> diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index e642b4c60..3790fcad6 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -28,6 +28,8 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); } // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} // public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");} + public void testGenericsInPointcuts_pr161502() { runTest("generics in pointcuts");} + public void testGenericsInPointcuts_pr161502_2() { runTest("generics in pointcuts - 2");} public void testNoNPEDueToMissingType_pr149908() { runTest("ensure no npe due to missing type");} public void testNoNPEDueToMember_pr149908() { runTest("ensure no npe due to missing member");} public void testPTWgetWithinTypeName_pr123423_1() { runTest("basic usage of getWithinTypeName");} diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index edf0868e6..ee379452d 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -39,6 +39,20 @@ <compile files="BadInterface.java" options="-emacssym"/> </ajc-test> + <ajc-test dir="bugs153/pr161502" title="generics in pointcuts"> + <compile files="Main.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(java.util.List Main.getElements())' in Type 'Main' (Main.java:31) advised by around advice from 'Main$Concrete' (Main.java:18)"/> + </compile> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs153/pr161502" title="generics in pointcuts - 2"> + <compile files="Main2.java" options="-1.5 -showWeaveInfo"> + <message kind="warning" text="advice defined in Main2$Base has not been applied"/> + </compile> + <run class="Main2"/> + </ajc-test> + <ajc-test dir="bugs153/pr158624" title="generics and arrays"> <compile files="ValueChange.java" options="-1.5"/> </ajc-test> diff --git a/weaver/src/org/aspectj/weaver/BoundedReferenceType.java b/weaver/src/org/aspectj/weaver/BoundedReferenceType.java index b1dbfe00f..456796e8c 100644 --- a/weaver/src/org/aspectj/weaver/BoundedReferenceType.java +++ b/weaver/src/org/aspectj/weaver/BoundedReferenceType.java @@ -13,6 +13,7 @@ package org.aspectj.weaver; import java.util.Collection; import java.util.Collections; +import java.util.Map; import org.aspectj.weaver.patterns.PerClause; @@ -33,7 +34,7 @@ public class BoundedReferenceType extends ReferenceType { protected boolean isSuper = false; public BoundedReferenceType(ReferenceType aBound, boolean isExtends, World world) { - super((isExtends ? "+" : "-") + aBound.signature,world); + super((isExtends ? "+" : "-") + aBound.signature,aBound.signatureErasure,world); this.isExtends = isExtends; this.isSuper = !isExtends; if (isExtends) { @@ -54,6 +55,18 @@ public class BoundedReferenceType extends ReferenceType { return additionalInterfaceBounds; } + public UnresolvedType parameterize(Map typeBindings) { + ReferenceType[] parameterizedAdditionalInterfaces = new ReferenceType[additionalInterfaceBounds==null?0:additionalInterfaceBounds.length]; + for (int i=0; i<parameterizedAdditionalInterfaces.length;i++) { + parameterizedAdditionalInterfaces[i] = (ReferenceType)additionalInterfaceBounds[i].parameterize(typeBindings); + } + if (isExtends) { + return new BoundedReferenceType((ReferenceType)getUpperBound().parameterize(typeBindings),isExtends,world,parameterizedAdditionalInterfaces); + } else { + return new BoundedReferenceType((ReferenceType)getLowerBound().parameterize(typeBindings),isExtends,world,parameterizedAdditionalInterfaces); + } + } + /** * only for use when resolving GenericsWildcardTypeX or a TypeVariableReferenceType */ diff --git a/weaver/src/org/aspectj/weaver/Checker.java b/weaver/src/org/aspectj/weaver/Checker.java index b7990c88c..9ff4dce5f 100644 --- a/weaver/src/org/aspectj/weaver/Checker.java +++ b/weaver/src/org/aspectj/weaver/Checker.java @@ -57,7 +57,7 @@ public class Checker extends ShadowMunger { public ShadowMunger parameterizeWith(ResolvedType declaringType,Map typeVariableMap) { Checker ret = new Checker( - getPointcut().parameterizeWith(typeVariableMap), + getPointcut().parameterizeWith(typeVariableMap,declaringType.getWorld()), getStart(), getEnd(), this.sourceContext); diff --git a/weaver/src/org/aspectj/weaver/ReferenceType.java b/weaver/src/org/aspectj/weaver/ReferenceType.java index 41bc6a66a..e93db655a 100644 --- a/weaver/src/org/aspectj/weaver/ReferenceType.java +++ b/weaver/src/org/aspectj/weaver/ReferenceType.java @@ -564,7 +564,7 @@ public class ReferenceType extends ResolvedType { PerClause pclause = delegate.getPerClause(); if (isParameterizedType()) { // could cache the result here... Map parameterizationMap = getAjMemberParameterizationMap(); - pclause = (PerClause)pclause.parameterizeWith(parameterizationMap); + pclause = (PerClause)pclause.parameterizeWith(parameterizationMap,world); } return pclause; } @@ -579,7 +579,7 @@ public class ReferenceType extends ResolvedType { Map parameterizationMap = getAjMemberParameterizationMap(); for (Iterator iter = genericDeclares.iterator(); iter.hasNext();) { Declare declareStatement = (Declare) iter.next(); - parameterizedDeclares.add(declareStatement.parameterizeWith(parameterizationMap)); + parameterizedDeclares.add(declareStatement.parameterizeWith(parameterizationMap,world)); } declares = parameterizedDeclares; } else { diff --git a/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java b/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java index e7aff6ea3..fbe738eeb 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java +++ b/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java @@ -141,7 +141,7 @@ public class ResolvedPointcutDefinition extends ResolvedMemberImpl { getName(), parameterizedParameterTypes, parameterizedReturnType, - pointcut.parameterizeWith(typeMap) + pointcut.parameterizeWith(typeMap,newDeclaringType.getWorld()) ); ret.setTypeVariables(getTypeVariables()); ret.setSourceContext(getSourceContext()); diff --git a/weaver/src/org/aspectj/weaver/ResolvedType.java b/weaver/src/org/aspectj/weaver/ResolvedType.java index b80992f71..a9e52a14a 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedType.java +++ b/weaver/src/org/aspectj/weaver/ResolvedType.java @@ -1855,10 +1855,11 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * with the passed bindings. */ public UnresolvedType parameterize(Map typeBindings) { - if (!isParameterizedType()) throw new IllegalStateException("Can't parameterize a type that is not a parameterized type"); + if (!isParameterizedType()) return this;//throw new IllegalStateException("Can't parameterize a type that is not a parameterized type"); boolean workToDo = false; for (int i = 0; i < typeParameters.length; i++) { - if (typeParameters[i].isTypeVariableReference()) { + if (typeParameters[i].isTypeVariableReference() || + (typeParameters[i] instanceof BoundedReferenceType)) { workToDo = true; } } @@ -1872,6 +1873,10 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl TypeVariableReferenceType tvrt = (TypeVariableReferenceType) newTypeParams[i]; UnresolvedType binding = (UnresolvedType) typeBindings.get(tvrt.getTypeVariable().getName()); if (binding != null) newTypeParams[i] = binding; + } else if (newTypeParams[i] instanceof BoundedReferenceType) { + BoundedReferenceType brType = (BoundedReferenceType)newTypeParams[i]; + newTypeParams[i] = brType.parameterize(typeBindings); +// brType.parameterize(typeBindings) } } return TypeFactory.createParameterizedType(getGenericType(), newTypeParams, getWorld()); diff --git a/weaver/src/org/aspectj/weaver/TypeVariable.java b/weaver/src/org/aspectj/weaver/TypeVariable.java index 13026970a..d85d7412d 100644 --- a/weaver/src/org/aspectj/weaver/TypeVariable.java +++ b/weaver/src/org/aspectj/weaver/TypeVariable.java @@ -376,4 +376,11 @@ public class TypeVariable { TypeVariable newVariable = new TypeVariable(name,ubound,ibounds); return newVariable; } + + public String getGenericSignature() { + return "T"+name+";"; + } + public String getErasureSignature() { + return getFirstBound().getErasureSignature(); + } } diff --git a/weaver/src/org/aspectj/weaver/TypeVariableReferenceType.java b/weaver/src/org/aspectj/weaver/TypeVariableReferenceType.java index e35ff5c86..4f6e8234b 100644 --- a/weaver/src/org/aspectj/weaver/TypeVariableReferenceType.java +++ b/weaver/src/org/aspectj/weaver/TypeVariableReferenceType.java @@ -13,6 +13,7 @@ package org.aspectj.weaver; import java.io.DataOutputStream; import java.io.IOException; +import java.util.Map; /** * Represents a type variable in a type or generic method declaration @@ -31,8 +32,9 @@ public class TypeVariableReferenceType extends BoundedReferenceType implements T public TypeVariableReferenceType( TypeVariable aTypeVariable, World aWorld) { - super(aTypeVariable.getFirstBound().getSignature(), - aTypeVariable.getFirstBound().getErasureSignature(), + super( + aTypeVariable.getGenericSignature(), + aTypeVariable.getErasureSignature(), aWorld); this.typeVariable = aTypeVariable; this.isExtends = false; @@ -65,6 +67,12 @@ public class TypeVariableReferenceType extends BoundedReferenceType implements T } } } + + public UnresolvedType parameterize(Map typeBindings) { + UnresolvedType ut = (UnresolvedType) typeBindings.get(getName()); + if (ut!=null) return ut; + return this; + } public ReferenceType[] getAdditionalBounds() { if (!resolvedIfBounds) { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java index c9fabc205..52483b472 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java @@ -101,7 +101,7 @@ public class BcelAdvice extends Advice { } public ShadowMunger parameterizeWith(ResolvedType declaringType,Map typeVariableMap) { - Pointcut pc = getPointcut().parameterizeWith(typeVariableMap); + Pointcut pc = getPointcut().parameterizeWith(typeVariableMap,declaringType.getWorld()); BcelAdvice ret = null; Member adviceSignature = signature; diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index b1c998ed8..0a392cc26 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -153,8 +153,8 @@ public class BcelTypeMunger extends ConcreteTypeMunger { } else if (munger.getKind().equals(ResolvedTypeMunger.FieldHost)) { ;//hidden } else { - ResolvedMember declaredSig = munger.getDeclaredSignature(); - if (declaredSig==null) declaredSig= munger.getSignature(); + ResolvedMember declaredSig = munger.getSignature(); +// if (declaredSig==null) declaredSig= munger.getSignature(); weaver.getWorld().getMessageHandler().handleMessage(WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ITD, new String[]{weaver.getLazyClassGen().getType().getName(), tName,munger.getKind().toString().toLowerCase(), diff --git a/weaver/src/org/aspectj/weaver/internal/tools/PointcutDesignatorHandlerBasedPointcut.java b/weaver/src/org/aspectj/weaver/internal/tools/PointcutDesignatorHandlerBasedPointcut.java index 63a7139e8..04b1554eb 100644 --- a/weaver/src/org/aspectj/weaver/internal/tools/PointcutDesignatorHandlerBasedPointcut.java +++ b/weaver/src/org/aspectj/weaver/internal/tools/PointcutDesignatorHandlerBasedPointcut.java @@ -19,6 +19,7 @@ import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.patterns.Bindings; @@ -133,7 +134,7 @@ public class PointcutDesignatorHandlerBasedPointcut extends Pointcut{ /* (non-Javadoc) * @see org.aspectj.weaver.patterns.Pointcut#parameterizeWith(java.util.Map) */ - public Pointcut parameterizeWith(Map typeVariableMap) { + public Pointcut parameterizeWith(Map typeVariableMap,World w) { return this; } diff --git a/weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java index 0193b44d6..f55f36d71 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java @@ -55,9 +55,9 @@ public class AndAnnotationTypePattern extends AnnotationTypePattern { return this; } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap) { - AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap); - AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap); + public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) { + AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap,w); + AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap,w); AndAnnotationTypePattern ret = new AndAnnotationTypePattern(newLeft,newRight); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java index 4fecf8f54..58608a793 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java @@ -23,6 +23,7 @@ import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Test; public class AndPointcut extends Pointcut { @@ -100,9 +101,9 @@ public class AndPointcut extends Pointcut { return ret; } - public Pointcut parameterizeWith(Map typeVariableMap) { - AndPointcut ret = new AndPointcut(left.parameterizeWith(typeVariableMap), - right.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + AndPointcut ret = new AndPointcut(left.parameterizeWith(typeVariableMap,w), + right.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java index 3d704cf76..8c45988e6 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java @@ -21,6 +21,7 @@ import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; /** * left && right @@ -107,9 +108,9 @@ public class AndTypePattern extends TypePattern { return this; } - public TypePattern parameterizeWith(Map typeVariableMap) { - TypePattern newLeft = left.parameterizeWith(typeVariableMap); - TypePattern newRight = right.parameterizeWith(typeVariableMap); + public TypePattern parameterizeWith(Map typeVariableMap,World w) { + TypePattern newLeft = left.parameterizeWith(typeVariableMap,w); + TypePattern newRight = right.parameterizeWith(typeVariableMap,w); AndTypePattern ret = new AndTypePattern(newLeft,newRight); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java index 0f3f98122..f423eb350 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java +++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java @@ -58,10 +58,10 @@ public class AnnotationPatternList extends PatternNode { return typePatterns; } - public AnnotationPatternList parameterizeWith(Map typeVariableMap) { + public AnnotationPatternList parameterizeWith(Map typeVariableMap,World w) { AnnotationTypePattern[] parameterizedPatterns = new AnnotationTypePattern[this.typePatterns.length]; for (int i = 0; i < parameterizedPatterns.length; i++) { - parameterizedPatterns[i] = this.typePatterns[i].parameterizeWith(typeVariableMap); + parameterizedPatterns[i] = this.typePatterns[i].parameterizeWith(typeVariableMap,w); } AnnotationPatternList ret = new AnnotationPatternList(parameterizedPatterns); ret.copyLocationFrom(this); diff --git a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java index d1541afe9..7a516754f 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java @@ -34,6 +34,7 @@ import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Var; @@ -86,8 +87,8 @@ public class AnnotationPointcut extends NameBindingPointcut { return Shadow.ALL_SHADOW_KINDS_BITS; } - public Pointcut parameterizeWith(Map typeVariableMap) { - AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern)annotationTypePattern.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern)annotationTypePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java index ea6626fdc..78a2b1042 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java @@ -46,7 +46,7 @@ public abstract class AnnotationTypePattern extends PatternNode { public abstract void resolve(World world); - public abstract AnnotationTypePattern parameterizeWith(Map/*name -> ResolvedType*/ typeVariableMap); + public abstract AnnotationTypePattern parameterizeWith(Map/*name -> ResolvedType*/ typeVariableMap,World w); public boolean isAny() { return false; } @@ -111,7 +111,7 @@ class AnyAnnotationTypePattern extends AnnotationTypePattern { public boolean isAny() { return true; } - public AnnotationTypePattern parameterizeWith(Map arg0) { + public AnnotationTypePattern parameterizeWith(Map arg0,World w) { return this; } } @@ -135,7 +135,7 @@ class EllipsisAnnotationTypePattern extends AnnotationTypePattern { return visitor.visit(this, data); } - public AnnotationTypePattern parameterizeWith(Map arg0) { + public AnnotationTypePattern parameterizeWith(Map arg0,World w) { return this; } diff --git a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java index b83a0544b..5c749cabd 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java @@ -27,6 +27,7 @@ import org.aspectj.weaver.Shadow; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Var; @@ -60,8 +61,8 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut { return Shadow.ALL_SHADOW_KINDS_BITS; // empty args() matches jps with no args } - public Pointcut parameterizeWith(Map typeVariableMap) { - ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(arguments.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(arguments.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java index a5d17eed6..67cfc41ef 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java @@ -58,8 +58,8 @@ public class ArgsPointcut extends NameBindingPointcut { return arguments; } - public Pointcut parameterizeWith(Map typeVariableMap) { - ArgsPointcut ret = new ArgsPointcut(this.arguments.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + ArgsPointcut ret = new ArgsPointcut(this.arguments.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java index 6cf54a33f..adecd08df 100644 --- a/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java @@ -69,7 +69,7 @@ public class BindingAnnotationTypePattern extends ExactAnnotationTypePattern imp } } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap) { + public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) { UnresolvedType newAnnotationType = annotationType; if (annotationType.isTypeVariableReference()) { TypeVariableReference t = (TypeVariableReference) annotationType; diff --git a/weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java index 3c4ded9bd..28c5739ad 100644 --- a/weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java @@ -22,6 +22,7 @@ import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; public class BindingTypePattern extends ExactTypePattern implements BindingPattern { private int formalIndex; @@ -82,8 +83,8 @@ public class BindingTypePattern extends ExactTypePattern implements BindingPatte } } - public TypePattern parameterizeWith(Map typeVariableMap) { - ExactTypePattern superParameterized = (ExactTypePattern) super.parameterizeWith(typeVariableMap); + public TypePattern parameterizeWith(Map typeVariableMap,World w) { + ExactTypePattern superParameterized = (ExactTypePattern) super.parameterizeWith(typeVariableMap,w); BindingTypePattern ret = new BindingTypePattern(superParameterized.getExactType(),this.formalIndex,this.isVarArgs); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java b/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java index ac8f35e6b..1229cd473 100644 --- a/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java @@ -110,8 +110,8 @@ public class CflowPointcut extends Pointcut { return ret; } - public Pointcut parameterizeWith(Map typeVariableMap) { - CflowPointcut ret = new CflowPointcut(entry.parameterizeWith(typeVariableMap),isBelow,freeVars); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + CflowPointcut ret = new CflowPointcut(entry.parameterizeWith(typeVariableMap,w),isBelow,freeVars); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java index 1053dbe82..a5a833917 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java @@ -30,6 +30,7 @@ import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Expr; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.bcel.BcelCflowAccessVar; @@ -98,7 +99,7 @@ public class ConcreteCflowPointcut extends Pointcut { throw new RuntimeException("unimplemented"); } - public Pointcut parameterizeWith(Map typeVariableMap) { + public Pointcut parameterizeWith(Map typeVariableMap,World w) { throw new RuntimeException("unimplemented"); } diff --git a/weaver/src/org/aspectj/weaver/patterns/Declare.java b/weaver/src/org/aspectj/weaver/patterns/Declare.java index c8d92bcf8..174001047 100644 --- a/weaver/src/org/aspectj/weaver/patterns/Declare.java +++ b/weaver/src/org/aspectj/weaver/patterns/Declare.java @@ -19,6 +19,7 @@ import java.util.Map; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; public abstract class Declare extends PatternNode { public static final byte ERROR_OR_WARNING = 1; @@ -57,7 +58,7 @@ public abstract class Declare extends PatternNode { * Returns a version of this declare element in which all references to type variables * are replaced with their bindings given in the map. */ - public abstract Declare parameterizeWith(Map typeVariableBindingMap); + public abstract Declare parameterizeWith(Map typeVariableBindingMap,World w); /** * Indicates if this declare should be treated like advice. If true, the diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareAnnotation.java b/weaver/src/org/aspectj/weaver/patterns/DeclareAnnotation.java index eb674c58a..e1ecb777c 100644 --- a/weaver/src/org/aspectj/weaver/patterns/DeclareAnnotation.java +++ b/weaver/src/org/aspectj/weaver/patterns/DeclareAnnotation.java @@ -127,12 +127,12 @@ public class DeclareAnnotation extends Declare { this.containingAspect = scope.getEnclosingType(); } - public Declare parameterizeWith(Map typeVariableBindingMap) { + public Declare parameterizeWith(Map typeVariableBindingMap,World w) { DeclareAnnotation ret; if (this.kind == AT_TYPE) { - ret = new DeclareAnnotation(kind,this.typePattern.parameterizeWith(typeVariableBindingMap)); + ret = new DeclareAnnotation(kind,this.typePattern.parameterizeWith(typeVariableBindingMap,w)); } else { - ret = new DeclareAnnotation(kind, this.sigPattern.parameterizeWith(typeVariableBindingMap)); + ret = new DeclareAnnotation(kind, this.sigPattern.parameterizeWith(typeVariableBindingMap,w)); } ret.annotationMethod = this.annotationMethod; ret.annotationString = this.annotationString; diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java b/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java index c9b663728..c8922933b 100644 --- a/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java +++ b/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java @@ -19,6 +19,7 @@ import java.util.Map; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; public class DeclareErrorOrWarning extends Declare { private boolean isError; @@ -101,8 +102,8 @@ public class DeclareErrorOrWarning extends Declare { pointcut = pointcut.resolve(scope); } - public Declare parameterizeWith(Map typeVariableBindingMap) { - Declare ret = new DeclareErrorOrWarning(isError,pointcut.parameterizeWith(typeVariableBindingMap),message); + public Declare parameterizeWith(Map typeVariableBindingMap,World w) { + Declare ret = new DeclareErrorOrWarning(isError,pointcut.parameterizeWith(typeVariableBindingMap,w),message); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java b/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java index 2a7baea26..414e1d8ba 100644 --- a/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java +++ b/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java @@ -73,11 +73,11 @@ public class DeclareParents extends Declare { return visitor.visit(this,data); } - public Declare parameterizeWith(Map typeVariableBindingMap) { + public Declare parameterizeWith(Map typeVariableBindingMap,World w) { DeclareParents ret = new DeclareParents( - child.parameterizeWith(typeVariableBindingMap), - parents.parameterizeWith(typeVariableBindingMap), + child.parameterizeWith(typeVariableBindingMap,w), + parents.parameterizeWith(typeVariableBindingMap,w), isExtends); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java b/weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java index 2415060e9..810f5ed91 100644 --- a/weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java +++ b/weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java @@ -23,6 +23,7 @@ import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; public class DeclarePrecedence extends Declare { private TypePatternList patterns; @@ -40,8 +41,8 @@ public class DeclarePrecedence extends Declare { return visitor.visit(this,data); } - public Declare parameterizeWith(Map typeVariableBindingMap) { - DeclarePrecedence ret = new DeclarePrecedence(this.patterns.parameterizeWith(typeVariableBindingMap)); + public Declare parameterizeWith(Map typeVariableBindingMap,World w) { + DeclarePrecedence ret = new DeclarePrecedence(this.patterns.parameterizeWith(typeVariableBindingMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java b/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java index a5011a5b8..ed6a78375 100644 --- a/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java +++ b/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java @@ -23,6 +23,7 @@ import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; public class DeclareSoft extends Declare { private TypePattern exception; @@ -37,11 +38,11 @@ public class DeclareSoft extends Declare { return visitor.visit(this,data); } - public Declare parameterizeWith(Map typeVariableBindingMap) { + public Declare parameterizeWith(Map typeVariableBindingMap,World w) { DeclareSoft ret = new DeclareSoft( - exception.parameterizeWith(typeVariableBindingMap), - pointcut.parameterizeWith(typeVariableBindingMap)); + exception.parameterizeWith(typeVariableBindingMap,w), + pointcut.parameterizeWith(typeVariableBindingMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java index a49f7d5c8..9f2a98a49 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java @@ -168,7 +168,7 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern { return this; } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap) { + public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) { UnresolvedType newAnnotationType = annotationType; if (annotationType.isTypeVariableReference()) { TypeVariableReference t = (TypeVariableReference) annotationType; diff --git a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java index 79397d206..39c3877a0 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -28,6 +28,7 @@ import org.aspectj.weaver.TypeVariableReference; import org.aspectj.weaver.TypeVariableReferenceType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; public class ExactTypePattern extends TypePattern { protected UnresolvedType type; @@ -232,7 +233,7 @@ public class ExactTypePattern extends TypePattern { * return a version of this type pattern with all type variables references replaced * by the corresponding entry in the map. */ - public TypePattern parameterizeWith(Map typeVariableMap) { + public TypePattern parameterizeWith(Map typeVariableMap,World w) { UnresolvedType newType = type; if (type.isTypeVariableReference()) { TypeVariableReference t = (TypeVariableReference) type; @@ -241,10 +242,10 @@ public class ExactTypePattern extends TypePattern { newType = (UnresolvedType) typeVariableMap.get(key); } } else if (type.isParameterizedType()) { - newType = type.parameterize(typeVariableMap); + newType = w.resolve(type).parameterize(typeVariableMap); } ExactTypePattern ret = new ExactTypePattern(newType,includeSubtypes,isVarArgs); - ret.annotationPattern = annotationPattern.parameterizeWith(typeVariableMap); + ret.annotationPattern = annotationPattern.parameterizeWith(typeVariableMap,w); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java b/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java index b39939112..b26dc9bb7 100644 --- a/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java @@ -26,6 +26,7 @@ import org.aspectj.weaver.Shadow; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; @@ -65,8 +66,8 @@ public class HandlerPointcut extends Pointcut { TypePattern.STATIC); } - public Pointcut parameterizeWith(Map typeVariableMap) { - HandlerPointcut ret = new HandlerPointcut(exceptionType.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + HandlerPointcut ret = new HandlerPointcut(exceptionType.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java index 9c966e6c7..263b7888f 100644 --- a/weaver/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java @@ -102,8 +102,8 @@ public class HasMemberTypePattern extends TypePattern { throw new UnsupportedOperationException("hasmethod/field do not support instanceof matching"); } - public TypePattern parameterizeWith(Map typeVariableMap) { - HasMemberTypePattern ret = new HasMemberTypePattern(signaturePattern.parameterizeWith(typeVariableMap)); + public TypePattern parameterizeWith(Map typeVariableMap,World w) { + HasMemberTypePattern ret = new HasMemberTypePattern(signaturePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java b/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java index f2615a1cf..304c26056 100644 --- a/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java @@ -35,6 +35,7 @@ import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Expr; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; @@ -368,7 +369,7 @@ public class IfPointcut extends Pointcut { } // we can't touch "if" methods - public Pointcut parameterizeWith(Map typeVariableMap) { + public Pointcut parameterizeWith(Map typeVariableMap,World w) { return this; } diff --git a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java index cc2064742..2d68d17b8 100644 --- a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java @@ -377,8 +377,8 @@ public class KindedPointcut extends Pointcut { return ret; } - public Pointcut parameterizeWith(Map typeVariableMap) { - Pointcut ret = new KindedPointcut(kind, signature.parameterizeWith(typeVariableMap), munger ); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + Pointcut ret = new KindedPointcut(kind, signature.parameterizeWith(typeVariableMap,w), munger ); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java index 83a0fb588..cd8cb3420 100644 --- a/weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java @@ -52,8 +52,8 @@ public class NotAnnotationTypePattern extends AnnotationTypePattern { } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap) { - AnnotationTypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap); + public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) { + AnnotationTypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap,w); NotAnnotationTypePattern ret = new NotAnnotationTypePattern(newNegatedPattern); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java b/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java index f5fcede37..297522b12 100644 --- a/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java @@ -23,6 +23,7 @@ import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Test; public class NotPointcut extends Pointcut { @@ -102,8 +103,8 @@ public class NotPointcut extends Pointcut { return ret; } - public Pointcut parameterizeWith(Map typeVariableMap) { - Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java index 6841c7088..5ade60e45 100644 --- a/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java @@ -22,6 +22,7 @@ import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; /** * !TypePattern @@ -103,8 +104,8 @@ public class NotTypePattern extends TypePattern { return this; } - public TypePattern parameterizeWith(Map typeVariableMap) { - TypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap); + public TypePattern parameterizeWith(Map typeVariableMap,World w) { + TypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap,w); NotTypePattern ret = new NotTypePattern(newNegatedPattern); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java index 886213c64..fe95053c4 100644 --- a/weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java @@ -49,9 +49,9 @@ public class OrAnnotationTypePattern extends AnnotationTypePattern { return this; } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap) { - AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap); - AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap); + public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) { + AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap,w); + AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap,w); OrAnnotationTypePattern ret = new OrAnnotationTypePattern(newLeft,newRight); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java index 4562b266c..01637f3b6 100644 --- a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java @@ -23,6 +23,7 @@ import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Test; public class OrPointcut extends Pointcut { @@ -103,9 +104,9 @@ public class OrPointcut extends Pointcut { return ret; } - public Pointcut parameterizeWith(Map typeVariableMap) { - Pointcut ret = new OrPointcut(left.parameterizeWith(typeVariableMap), - right.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + Pointcut ret = new OrPointcut(left.parameterizeWith(typeVariableMap,w), + right.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java index 63a0521f3..b5011cc5e 100644 --- a/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java @@ -21,6 +21,7 @@ import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; /** * left || right @@ -120,9 +121,9 @@ public class OrTypePattern extends TypePattern { return this; } - public TypePattern parameterizeWith(Map typeVariableMap) { - TypePattern newLeft = left.parameterizeWith(typeVariableMap); - TypePattern newRight = right.parameterizeWith(typeVariableMap); + public TypePattern parameterizeWith(Map typeVariableMap,World w) { + TypePattern newLeft = left.parameterizeWith(typeVariableMap,w); + TypePattern newRight = right.parameterizeWith(typeVariableMap,w); OrTypePattern ret = new OrTypePattern(newLeft,newRight); ret.copyLocationFrom(this); return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/PerCflow.java b/weaver/src/org/aspectj/weaver/patterns/PerCflow.java index deb7419f1..a8395fa2a 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PerCflow.java +++ b/weaver/src/org/aspectj/weaver/patterns/PerCflow.java @@ -70,8 +70,8 @@ public class PerCflow extends PerClause { entry.resolve(scope); } - public Pointcut parameterizeWith(Map typeVariableMap) { - PerCflow ret = new PerCflow(entry.parameterizeWith(typeVariableMap),isBelow); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + PerCflow ret = new PerCflow(entry.parameterizeWith(typeVariableMap,w),isBelow); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java b/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java index cfe742ac7..13c81fe93 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java +++ b/weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java @@ -24,6 +24,7 @@ import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Test; public class PerFromSuper extends PerClause { @@ -76,7 +77,7 @@ public class PerFromSuper extends PerClause { } } - public Pointcut parameterizeWith(Map typeVariableMap) { + public Pointcut parameterizeWith(Map typeVariableMap,World w) { return this; } diff --git a/weaver/src/org/aspectj/weaver/patterns/PerObject.java b/weaver/src/org/aspectj/weaver/patterns/PerObject.java index 7ed45392b..c22973492 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PerObject.java +++ b/weaver/src/org/aspectj/weaver/patterns/PerObject.java @@ -81,8 +81,8 @@ public class PerObject extends PerClause { entry.resolve(scope); } - public Pointcut parameterizeWith(Map typeVariableMap) { - PerObject ret = new PerObject(entry.parameterizeWith(typeVariableMap),isThis); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + PerObject ret = new PerObject(entry.parameterizeWith(typeVariableMap,w),isThis); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java b/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java index 3852b6a7a..f2d6d39c6 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java +++ b/weaver/src/org/aspectj/weaver/patterns/PerSingleton.java @@ -23,6 +23,7 @@ import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Expr; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; @@ -52,7 +53,7 @@ public class PerSingleton extends PerClause { // this method intentionally left blank } - public Pointcut parameterizeWith(Map typeVariableMap) { + public Pointcut parameterizeWith(Map typeVariableMap,World w) { return this; } diff --git a/weaver/src/org/aspectj/weaver/patterns/PerTypeWithin.java b/weaver/src/org/aspectj/weaver/patterns/PerTypeWithin.java index a824a0545..ee47eacc8 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PerTypeWithin.java +++ b/weaver/src/org/aspectj/weaver/patterns/PerTypeWithin.java @@ -60,8 +60,8 @@ public class PerTypeWithin extends PerClause { return kindSet; } - public Pointcut parameterizeWith(Map typeVariableMap) { - PerTypeWithin ret = new PerTypeWithin(typePattern.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + PerTypeWithin ret = new PerTypeWithin(typePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java index 2f4e583ec..424d623f4 100644 --- a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java @@ -371,7 +371,7 @@ public abstract class Pointcut extends PatternNode { return visitor.visit(this, data); } - public Pointcut parameterizeWith(Map typeVariableMap) { + public Pointcut parameterizeWith(Map typeVariableMap,World w) { return this; } } @@ -391,6 +391,6 @@ public abstract class Pointcut extends PatternNode { } } - public abstract Pointcut parameterizeWith(Map typeVariableMap); + public abstract Pointcut parameterizeWith(Map typeVariableMap,World w); } diff --git a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java index 2dcdf61f4..7b49ae36d 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -33,6 +33,7 @@ import org.aspectj.weaver.TypeVariableReference; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Test; /** @@ -219,7 +220,7 @@ public class ReferencePointcut extends Pointcut { TypePattern p = arguments.get(i); //we are allowed to bind to pointcuts which use subtypes as this is type safe if (typeVariableMap != null) { - p = p.parameterizeWith(typeVariableMap); + p = p.parameterizeWith(typeVariableMap,scope.getWorld()); } if (p == TypePattern.NO) { scope.message(IMessage.ERROR, this, @@ -355,7 +356,7 @@ public class ReferencePointcut extends Pointcut { try { Pointcut ret = pointcutDec.getPointcut(); if (typeVariableMap != null && !hasBeenParameterized) { - ret = ret.parameterizeWith(typeVariableMap); + ret = ret.parameterizeWith(typeVariableMap,searchStart.getWorld()); ret.hasBeenParameterized=true; } return ret.concretize(searchStart, declaringType, newBindings); @@ -373,7 +374,7 @@ public class ReferencePointcut extends Pointcut { * Tricky thing is, we can't do this at the point in time this method will be called, so we make a * version that will parameterize the pointcut it ultimately resolves to. */ - public Pointcut parameterizeWith(Map typeVariableMap) { + public Pointcut parameterizeWith(Map typeVariableMap,World w) { ReferencePointcut ret = new ReferencePointcut(onType,name,arguments); ret.onTypeSymbolic = onTypeSymbolic; ret.typeVariableMap = typeVariableMap; diff --git a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java index fc8f448c3..b31287e77 100644 --- a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java @@ -261,16 +261,16 @@ public class SignaturePattern extends PatternNode { * return a copy of this signature pattern in which every type variable reference * is replaced by the corresponding entry in the map. */ - public SignaturePattern parameterizeWith(Map typeVariableMap) { + public SignaturePattern parameterizeWith(Map typeVariableMap,World w) { SignaturePattern ret = new SignaturePattern( kind, modifiers, - returnType.parameterizeWith(typeVariableMap), - declaringType.parameterizeWith(typeVariableMap), + returnType.parameterizeWith(typeVariableMap,w), + declaringType.parameterizeWith(typeVariableMap,w), name, - parameterTypes.parameterizeWith(typeVariableMap), - throwsPattern.parameterizeWith(typeVariableMap), - annotationPattern.parameterizeWith(typeVariableMap)); + parameterTypes.parameterizeWith(typeVariableMap,w), + throwsPattern.parameterizeWith(typeVariableMap,w), + annotationPattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java index a234c107b..4285a411c 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java @@ -27,6 +27,7 @@ import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Var; @@ -84,12 +85,12 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { return isThis ? thisKindSet : targetKindSet; } - public Pointcut parameterizeWith(Map typeVariableMap) { - ExactAnnotationTypePattern newPattern = (ExactAnnotationTypePattern) this.annotationTypePattern.parameterizeWith(typeVariableMap); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + ExactAnnotationTypePattern newPattern = (ExactAnnotationTypePattern) this.annotationTypePattern.parameterizeWith(typeVariableMap,w); if (newPattern.getAnnotationType() instanceof ResolvedType) { verifyRuntimeRetention((ResolvedType)newPattern.getResolvedAnnotationType()); } - ThisOrTargetAnnotationPointcut ret = new ThisOrTargetAnnotationPointcut(isThis,(ExactAnnotationTypePattern)annotationTypePattern.parameterizeWith(typeVariableMap)); + ThisOrTargetAnnotationPointcut ret = new ThisOrTargetAnnotationPointcut(isThis,(ExactAnnotationTypePattern)annotationTypePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java index bc9d40ae2..17398377b 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java @@ -30,6 +30,7 @@ import org.aspectj.weaver.Shadow; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Var; @@ -86,8 +87,8 @@ public class ThisOrTargetPointcut extends NameBindingPointcut { public boolean isThis() { return isThis; } - public Pointcut parameterizeWith(Map typeVariableMap) { - ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis,type.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis,type.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java b/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java index eedefc27c..04dd0c264 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java @@ -76,10 +76,10 @@ public class ThrowsPattern extends PatternNode { return this; } - public ThrowsPattern parameterizeWith(Map/*name -> resolved type*/ typeVariableMap) { + public ThrowsPattern parameterizeWith(Map/*name -> resolved type*/ typeVariableMap,World w) { ThrowsPattern ret = new ThrowsPattern( - required.parameterizeWith(typeVariableMap), - forbidden.parameterizeWith(typeVariableMap)); + required.parameterizeWith(typeVariableMap,w), + forbidden.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java index 45de16f48..49eb0c314 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java @@ -229,7 +229,7 @@ public abstract class TypePattern extends PatternNode { * return a version of this type pattern in which all type variable references have been * replaced by their corresponding entry in the map. */ - public abstract TypePattern parameterizeWith(Map typeVariableMap); + public abstract TypePattern parameterizeWith(Map typeVariableMap,World w); public void postRead(ResolvedType enclosingType) { } @@ -360,7 +360,7 @@ class EllipsisTypePattern extends TypePattern { return visitor.visit(this, data); } - public TypePattern parameterizeWith(Map typeVariableMap) { + public TypePattern parameterizeWith(Map typeVariableMap,World w) { return this; } @@ -441,7 +441,7 @@ class AnyTypePattern extends TypePattern { return visitor.visit(this, data); } - public TypePattern parameterizeWith(Map arg0) { + public TypePattern parameterizeWith(Map arg0,World w) { return this; } } @@ -482,8 +482,8 @@ class AnyWithAnnotationTypePattern extends TypePattern { return FuzzyBoolean.MAYBE; } - public TypePattern parameterizeWith(Map typeVariableMap) { - AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith(typeVariableMap)); + public TypePattern parameterizeWith(Map typeVariableMap,World w) { + AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } @@ -603,7 +603,7 @@ class NoTypePattern extends TypePattern { return visitor.visit(this, data); } - public TypePattern parameterizeWith(Map arg0) { + public TypePattern parameterizeWith(Map arg0,World w) { return this; } } diff --git a/weaver/src/org/aspectj/weaver/patterns/TypePatternList.java b/weaver/src/org/aspectj/weaver/patterns/TypePatternList.java index 35864aeeb..aec01ed74 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypePatternList.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypePatternList.java @@ -26,6 +26,7 @@ import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; +import org.aspectj.weaver.World; public class TypePatternList extends PatternNode { private TypePattern[] typePatterns; @@ -189,10 +190,10 @@ public class TypePatternList extends PatternNode { * @param typeVariableMap * @return */ - public TypePatternList parameterizeWith(Map typeVariableMap) { + public TypePatternList parameterizeWith(Map typeVariableMap,World w) { TypePattern[] parameterizedPatterns = new TypePattern[typePatterns.length]; for (int i = 0; i < parameterizedPatterns.length; i++) { - parameterizedPatterns[i] = typePatterns[i].parameterizeWith(typeVariableMap); + parameterizedPatterns[i] = typePatterns[i].parameterizeWith(typeVariableMap,w); } return new TypePatternList(parameterizedPatterns); } diff --git a/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java index 7a3bb3ce6..35c18bc3d 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java @@ -108,8 +108,8 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { } } - public AnnotationTypePattern parameterizeWith(Map typeVariableMap) { - WildAnnotationTypePattern ret = new WildAnnotationTypePattern(typePattern.parameterizeWith(typeVariableMap)); + public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) { + WildAnnotationTypePattern ret = new WildAnnotationTypePattern(typePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); ret.resolved = resolved; return ret; diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java index 323583652..69a67ba4b 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java @@ -536,7 +536,7 @@ public class WildTypePattern extends TypePattern { return buf.toString(); } - public TypePattern parameterizeWith(Map typeVariableMap) { + public TypePattern parameterizeWith(Map typeVariableMap,World w) { NamePattern[] newNamePatterns = new NamePattern[namePatterns.length]; for(int i=0; i<namePatterns.length;i++) { newNamePatterns[i] = namePatterns[i]; } if (newNamePatterns.length == 1) { @@ -558,19 +558,19 @@ public class WildTypePattern extends TypePattern { includeSubtypes, dim, isVarArgs, - typeParameters.parameterizeWith(typeVariableMap) + typeParameters.parameterizeWith(typeVariableMap,w) ); - ret.annotationPattern = this.annotationPattern.parameterizeWith(typeVariableMap); + ret.annotationPattern = this.annotationPattern.parameterizeWith(typeVariableMap,w); if (additionalInterfaceBounds == null) { ret.additionalInterfaceBounds = null; } else { ret.additionalInterfaceBounds = new TypePattern[additionalInterfaceBounds.length]; for (int i = 0; i < additionalInterfaceBounds.length; i++) { - ret.additionalInterfaceBounds[i] = additionalInterfaceBounds[i].parameterizeWith(typeVariableMap); + ret.additionalInterfaceBounds[i] = additionalInterfaceBounds[i].parameterizeWith(typeVariableMap,w); } } - ret.upperBound = upperBound != null ? upperBound.parameterizeWith(typeVariableMap) : null; - ret.lowerBound = lowerBound != null ? lowerBound.parameterizeWith(typeVariableMap) : null; + ret.upperBound = upperBound != null ? upperBound.parameterizeWith(typeVariableMap,w) : null; + ret.lowerBound = lowerBound != null ? lowerBound.parameterizeWith(typeVariableMap,w) : null; ret.isGeneric = isGeneric; ret.knownMatches = knownMatches; ret.importedPrefixes = importedPrefixes; diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java index 6b01b39bb..edda22658 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java @@ -28,6 +28,7 @@ import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Var; @@ -68,8 +69,8 @@ public class WithinAnnotationPointcut extends NameBindingPointcut { return Shadow.ALL_SHADOW_KINDS_BITS; } - public Pointcut parameterizeWith(Map typeVariableMap) { - WithinAnnotationPointcut ret = new WithinAnnotationPointcut(this.annotationTypePattern.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + WithinAnnotationPointcut ret = new WithinAnnotationPointcut(this.annotationTypePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java index 8bc2439a5..74cb2a620 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java @@ -31,6 +31,7 @@ import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.ast.Var; @@ -78,8 +79,8 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut { return matchedShadowKinds; } - public Pointcut parameterizeWith(Map typeVariableMap) { - WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)this.annotationTypePattern.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)this.annotationTypePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java index 94737fe70..aaab8355b 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java @@ -26,6 +26,7 @@ import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; @@ -55,8 +56,8 @@ public class WithinPointcut extends Pointcut { return Shadow.ALL_SHADOW_KINDS_BITS; } - public Pointcut parameterizeWith(Map typeVariableMap) { - WithinPointcut ret = new WithinPointcut(this.typePattern.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + WithinPointcut ret = new WithinPointcut(this.typePattern.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java index dd0f71136..91beeb87c 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java @@ -25,6 +25,7 @@ import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.VersionedDataInputStream; import org.aspectj.weaver.WeaverMessages; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; @@ -56,8 +57,8 @@ public class WithincodePointcut extends Pointcut { return matchedShadowKinds; } - public Pointcut parameterizeWith(Map typeVariableMap) { - WithincodePointcut ret = new WithincodePointcut(signature.parameterizeWith(typeVariableMap)); + public Pointcut parameterizeWith(Map typeVariableMap,World w) { + WithincodePointcut ret = new WithincodePointcut(signature.parameterizeWith(typeVariableMap,w)); ret.copyLocationFrom(this); return ret; } |