diff options
author | acolyer <acolyer> | 2005-11-21 17:15:51 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-11-21 17:15:51 +0000 |
commit | 5947ce663998ee3a8f332586175d287ad3f52f65 (patch) | |
tree | df70371f4e7337528a71ac88806f3d3a2b56d1b5 /tests/java5 | |
parent | 2d0af56cbcad1de209d5432fca11c02ae8e26566 (diff) | |
download | aspectj-5947ce663998ee3a8f332586175d287ad3f52f65.tar.gz aspectj-5947ce663998ee3a8f332586175d287ad3f52f65.zip |
test (passing) for pr113368. Tests for reading compiled pointcuts from reflection world.
Diffstat (limited to 'tests/java5')
-rw-r--r-- | tests/java5/reflection/PointcutLibrary.aj | 23 | ||||
-rw-r--r-- | tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java | 21 |
2 files changed, 37 insertions, 7 deletions
diff --git a/tests/java5/reflection/PointcutLibrary.aj b/tests/java5/reflection/PointcutLibrary.aj index f3e59e21c..c81f8cf05 100644 --- a/tests/java5/reflection/PointcutLibrary.aj +++ b/tests/java5/reflection/PointcutLibrary.aj @@ -1,6 +1,7 @@ // random collection of pointcuts to check that // reflective world and PointcutParser can interpret // them correctly. +import java.lang.annotation.*; public aspect PointcutLibrary { @@ -10,5 +11,25 @@ public aspect PointcutLibrary { public pointcut propertyGet() : execution(!void get*(..)); public pointcut propertySet(Object newValue) : execution(void set*(..)) && args(newValue); + public pointcut getAndThis(Object thisObj) : + get(* *) && this(thisObj); + public pointcut getAndTarget(Object targetObj) : + get(* *) && target(targetObj); + public pointcut getAndAtAnnotation(MyAnn ann) : + get(* *) && @annotation(ann); + public pointcut getAndAtWithin(MyAnn ann) : + get(* *) && @within(ann); + public pointcut getAndAtWithinCode(MyAnn ann) : + get(* *) && @withincode(ann); + public pointcut getAndAtThis(MyAnn ann) : + get(* *) && @this(ann); + public pointcut getAndAtTarget(MyAnn ann) : + get(* *) && @target(ann); + public pointcut setAndAtArgs(MyAnn ann) : + set(* *) && @args(ann); -}
\ No newline at end of file + +} + +@Retention(RetentionPolicy.RUNTIME) +@interface MyAnn {}
\ No newline at end of file diff --git a/tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java b/tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java index 9dc9927be..539e0f767 100644 --- a/tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java +++ b/tests/java5/reflection/ReflectOnAjcCompiledPointcuts.java @@ -5,13 +5,22 @@ 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)"); +// 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)"); + pe = p.parsePointcutExpression("PointcutLibrary.getAndThis(Object)"); + pe = p.parsePointcutExpression("PointcutLibrary.getAndTarget(Object)"); + pe = p.parsePointcutExpression("PointcutLibrary.getAndAtAnnotation(MyAnn)"); + pe = p.parsePointcutExpression("PointcutLibrary.getAndAtWithin(MyAnn)"); + pe = p.parsePointcutExpression("PointcutLibrary.getAndAtWithinCode(MyAnn)"); + pe = p.parsePointcutExpression("PointcutLibrary.getAndAtThis(MyAnn)"); + pe = p.parsePointcutExpression("PointcutLibrary.getAndAtTarget(MyAnn)"); + pe = p.parsePointcutExpression("PointcutLibrary.setAndAtArgs(MyAnn)"); - PointcutParameter pp = p.createPointcutParameter("foo",String.class); + + PointcutParameter pp = p.createPointcutParameter("foo",Object.class); p.parsePointcutExpression("execution(* *(..)) && PointcutLibrary.propertySet(foo)", Object.class, new PointcutParameter[] {pp}); |