@@ -0,0 +1,22 @@ | |||
abstract aspect GenericAbstractAspect<T>{ | |||
abstract protected pointcut pc(); | |||
before() : pc() {} | |||
} | |||
aspect Concrete extends GenericAbstractAspect<Concrete> { | |||
// should get circular dependency error message from this | |||
protected pointcut pc() : pc(); | |||
} | |||
aspect Concrete2 extends GenericAbstractAspect<Concrete2> { | |||
// this should compile as expected | |||
protected pointcut pc() : p1(); | |||
pointcut p1() : call(void Concrete2.foo(..)); | |||
} | |||
aspect Concrete3 extends GenericAbstractAspect<Concrete3> { | |||
// should get circular dependency error message from this | |||
protected pointcut pc() : pc1(); | |||
pointcut pc1() : pc2(); | |||
pointcut pc2() : pc(); | |||
} |
@@ -0,0 +1,28 @@ | |||
abstract aspect GenericAbstractAspect<T> { | |||
abstract protected pointcut pc(); | |||
before() : pc() {} | |||
} | |||
abstract aspect SubGenericAspect<T> extends GenericAbstractAspect<T> { | |||
abstract protected pointcut pc1(); | |||
abstract protected pointcut pc3(); | |||
protected pointcut pc() : pc1(); | |||
protected pointcut pc2() : pc3(); | |||
} | |||
// this should compile with no errors | |||
aspect Concrete2 extends SubGenericAspect<String> { | |||
protected pointcut pc() : pc1(); | |||
protected pointcut pc1() :pc3(); | |||
protected pointcut pc3() : execution(* *(String)); | |||
} | |||
class C { | |||
public void method(String s) { | |||
} | |||
public void method2(int i) { | |||
} | |||
} |
@@ -703,6 +703,13 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
runTest("no verify error with two args pcds"); | |||
} | |||
public void testNoStackOverflowWithCircularPCDInGenericAspect() { | |||
runTest("no StackOverflowError with circular pcd in generic aspect"); | |||
} | |||
public void testNoStackOverflowWithCircularPCDInGenericAspect2() { | |||
runTest("no StackOverflowError with circular pcd in generic aspect - 2"); | |||
} | |||
// helper methods..... | |||
@@ -976,6 +976,19 @@ | |||
<run class="PR113447e"/> | |||
</ajc-test> | |||
<ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect"> | |||
<compile files="pr115235.aj" options="-1.5"> | |||
<message kind="warning" line="3" text="advice defined in GenericAbstractAspect has not been applied [Xlint:adviceDidNotMatch]"/> | |||
<message kind="error" text="circular pointcut declaration involving: pc()"/> | |||
<message kind="error" line="20" text="circular pointcut declaration involving: pc2()"/> | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect - 2"> | |||
<compile files="pr115235b.aj" options="-1.5"> | |||
</compile> | |||
</ajc-test> | |||
<!-- ============================================================================ --> | |||
<!-- ============================================================================ --> | |||
@@ -104,6 +104,8 @@ public abstract class Pointcut extends PatternNode { | |||
private FuzzyBoolean lastMatchedShadowResult; | |||
private String[] typeVariablesInScope = new String[0]; | |||
protected boolean hasBeenParameterized = false; | |||
/** | |||
* Constructor for Pattern. | |||
*/ |
@@ -322,7 +322,10 @@ public class ReferencePointcut extends Pointcut { | |||
newBindings.pushEnclosingDefinition(pointcutDec); | |||
try { | |||
Pointcut ret = pointcutDec.getPointcut(); | |||
if (typeVariableMap != null) ret = ret.parameterizeWith(typeVariableMap); | |||
if (typeVariableMap != null && !hasBeenParameterized) { | |||
ret = ret.parameterizeWith(typeVariableMap); | |||
ret.hasBeenParameterized=true; | |||
} | |||
return ret.concretize(searchStart, declaringType, newBindings); | |||
} finally { | |||
newBindings.popEnclosingDefinitition(); |