diff options
author | acolyer <acolyer> | 2005-11-19 17:08:48 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-11-19 17:08:48 +0000 |
commit | 522911ec81aeb3ec5b600939d3a2ee6e6297fd0c (patch) | |
tree | 311498b219cf1905e36eb022efedbcfdff785651 /tests | |
parent | 99504bc120db0049fb441bb69b0f37a4a4f29cd9 (diff) | |
download | aspectj-522911ec81aeb3ec5b600939d3a2ee6e6297fd0c.tar.gz aspectj-522911ec81aeb3ec5b600939d3a2ee6e6297fd0c.zip |
tests and fix for pr116229 and pr116755. Also adds support and tests for parseTypePattern in PointcutParser.
Diffstat (limited to 'tests')
6 files changed, 49 insertions, 2 deletions
diff --git a/tests/java5/ataspectj/annotationGen/RuntimePointcuts.java b/tests/java5/ataspectj/annotationGen/RuntimePointcuts.java index 8f9e530d5..171239cd5 100644 --- a/tests/java5/ataspectj/annotationGen/RuntimePointcuts.java +++ b/tests/java5/ataspectj/annotationGen/RuntimePointcuts.java @@ -6,6 +6,7 @@ public class RuntimePointcuts { public static void main(String[] args) throws Exception { PointcutParser parser = new PointcutParser(); + parser.setClassLoader(RuntimePointcuts.class.getClassLoader()); PointcutExpression pc1 = parser.parsePointcutExpression("PCLib.anyMethodExecution()"); PointcutParameter param = parser.createPointcutParameter("s",String.class); PointcutExpression pc2 = parser.parsePointcutExpression("PCLib.joinPointWithStringArg(s)",RuntimePointcuts.class,new PointcutParameter[] {param}); diff --git a/tests/java5/reflection/PointcutLibrary.aj b/tests/java5/reflection/PointcutLibrary.aj new file mode 100644 index 000000000..f3e59e21c --- /dev/null +++ b/tests/java5/reflection/PointcutLibrary.aj @@ -0,0 +1,14 @@ +// random collection of pointcuts to check that +// reflective world and PointcutParser can interpret +// them correctly. + +public aspect PointcutLibrary { + + public pointcut propertyAccess() : get(* *); + public pointcut propertyUpdate() : set(* *); + public pointcut methodExecution() : execution(* *(..)); + public pointcut propertyGet() : execution(!void get*(..)); + public pointcut propertySet(Object newValue) + : execution(void set*(..)) && args(newValue); + +}
\ No newline at end of file diff --git a/tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java b/tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java new file mode 100644 index 000000000..9dc9927be --- /dev/null +++ b/tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java @@ -0,0 +1,22 @@ +import org.aspectj.weaver.tools.*; + +public class ReflectOnAjcCompiledPointcuts { + + public static void main(String[] args) { + PointcutParser p = new PointcutParser(); + PointcutExpression pe = null; + pe = p.parsePointcutExpression("PointcutLibrary.propertyAccess()"); + pe = p.parsePointcutExpression("PointcutLibrary.propertyUpdate()"); + pe = p.parsePointcutExpression("PointcutLibrary.methodExecution()"); + pe = p.parsePointcutExpression("PointcutLibrary.propertyGet()"); + pe = p.parsePointcutExpression("PointcutLibrary.propertySet(Object)"); + + PointcutParameter pp = p.createPointcutParameter("foo",String.class); + p.parsePointcutExpression("execution(* *(..)) && PointcutLibrary.propertySet(foo)", + Object.class, + new PointcutParameter[] {pp}); + + } + + +}
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index 18b73fd8c..253a9fe72 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -713,6 +713,11 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("no StackOverflowError with circular pcd in generic aspect - 2"); } + +// public void testPointcutParsingOfCompiledPointcuts() { +// runTest("pointcut parsing with ajc compiled pointcut references"); +// } + /* * Load-time weaving bugs */ diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 739897885..c0aa8b999 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -52,7 +52,12 @@ <ajc-test dir="bugs150" pr="112756" title="pointcut expression containing 'assert'"> <compile files="Pr112756.aj" options="-warn:assertIdentifier -Xdev:Pinpoint"/> </ajc-test> - + + <ajc-test dir="java5/reflection" title="pointcut parsing with ajc compiled pointcut references"> + <compile files="PointcutLibrary.aj,ReflectOnAjcCompiledPointcuts.java"></compile> + <run class="ReflectOnAjcCompiledPointcuts" classpath=".;../lib/aspectj/aspectjtools.jar"/> + </ajc-test> + <ajc-test dir="bugs150/pr114436" title="ClassFormatError binary weaving perthis"> <compile files="SimpleTrace.aj,ConcreteSimpleTracing.aj" outjar="aspects.jar"/> <compile files="TestClass.java" aspectpath="aspects.jar"/> diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml index 33c28dbb3..1ece44117 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml @@ -146,7 +146,7 @@ <ajc-test dir="java5/ataspectj/annotationGen" title="runtime pointcut resolution referencing compiled pointcuts"> <compile files="PCLib.aj,RuntimePointcuts.java" options="-1.5"> </compile> - <run class="RuntimePointcuts" classpath="../lib/bcel/bcel.jar"/> + <run class="RuntimePointcuts" classpath=".;../lib/bcel/bcel.jar" ltw=""/> </ajc-test> <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for decp"> |