@@ -0,0 +1,19 @@ | |||
package abc; | |||
import org.aspectj.lang.annotation.*; | |||
@Aspect | |||
public class pr138215 { | |||
@DeclareWarning("fooExecution()") | |||
public static final String warning = "no foos please"; | |||
@Pointcut("execution(* foo())") | |||
public void fooExecution() {} | |||
} | |||
class Fooey { | |||
public void foo() {} | |||
} |
@@ -0,0 +1,7 @@ | |||
public aspect PerThisWithReference perthis(mypc()) { | |||
pointcut mypc() : SomeOtherType.pc(); | |||
} |
@@ -0,0 +1,5 @@ | |||
public aspect SomeOtherType { | |||
public pointcut pc() : execution(* *(..)); | |||
} |
@@ -0,0 +1,17 @@ | |||
import org.aspectj.lang.annotation.*; | |||
@Aspect("perthis(pc())") | |||
public class AtAspectWithPerClause { | |||
@Pointcut("execution(* *(..))") | |||
public void pc() {} | |||
} | |||
@Aspect | |||
class Foo { | |||
@Pointcut("execution(* *(..))") | |||
public void pc() {} | |||
} |
@@ -0,0 +1,33 @@ | |||
import java.lang.annotation.*; | |||
@Retention(RetentionPolicy.RUNTIME) | |||
@interface Tx { | |||
boolean readOnly() default false; | |||
} | |||
public aspect DoubleAnnotationMatching { | |||
pointcut methodInTxType(Tx tx) : | |||
execution(* *(..)) && @this(tx) && if(tx.readOnly()); | |||
pointcut txMethod(Tx tx) : | |||
execution(* *(..)) && @annotation(tx) && if(tx.readOnly()); | |||
pointcut transactionalOperation() : | |||
methodInTxType(Tx) || txMethod(Tx); | |||
before() : transactionalOperation() { | |||
// do something | |||
} | |||
} | |||
@Tx class Foo { | |||
public void foo() {} | |||
@Tx public void bar() {} | |||
} |
@@ -31,7 +31,15 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
public void testStackOverflow_pr136258() { runTest("stack overflow");} | |||
public void testIncorrectOverridesEvaluation13() { runTest("incorrect overrides evaluation - 1.3"); } | |||
public void testIncorrectOverridesEvaluation15() { runTest("incorrect overrides evaluation - 1.5"); } | |||
// known failures, uncomment when working. | |||
// public void testReferencePCutInDeclareWarning_pr138215() { runTest("Reference pointcut fails inside @DeclareWarning");} | |||
// public void testReferencePCutInPerClause_pr138219() { runTest("Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause");} | |||
// public void testDoubleAnnotationMatching_pr138223() { runTest("Double at annotation matching (no binding)");} | |||
// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet... | |||
//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");} | |||
///////////////////////////////////////// | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class); |
@@ -133,4 +133,25 @@ | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs152/pr138215" pr="138215" title="Reference pointcut fails inside @DeclareWarning"> | |||
<compile files="pr138215.aj" options="-1.5"> | |||
<message kind="warning" line="17" text="no foos please"/> | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs152/pr138219" pr="138219" title="Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause"> | |||
<compile files="PerThisWithReference.aj,SomeOtherType.aj" options="-1.5"> | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs152/pr138220" pr="138220" title="@Aspect with reference pointcut in perclause"> | |||
<compile files="AtAspectWithPerClause.aj" options="-1.5"> | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs152/pr138223" pr="138223" title="Double at annotation matching (no binding)"> | |||
<compile files="DoubleAnnotationMatching.aj" options="-1.5"> | |||
</compile> | |||
</ajc-test> | |||
</suite> |