aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features153/ptw/CaseFive.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features153/ptw/CaseFive.java')
-rw-r--r--tests/features153/ptw/CaseFive.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/features153/ptw/CaseFive.java b/tests/features153/ptw/CaseFive.java
new file mode 100644
index 000000000..e95edddd8
--- /dev/null
+++ b/tests/features153/ptw/CaseFive.java
@@ -0,0 +1,27 @@
+import java.lang.reflect.Method;
+
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.*;
+
+class AClass {}
+class BClass {}
+class CClass {}
+
+@Aspect("pertypewithin(*Class)")
+public class CaseFive {
+ public static void main(String []argv) throws Exception {
+ new Runner().run();
+ }
+}
+
+class Runner {
+ public void run() throws Exception {
+ if (Aspects14.hasAspect(CaseFive.class,AClass.class)) {
+ System.out.println("AClass has an aspect instance");
+ CaseFive instance = (CaseFive)Aspects14.aspectOf(CaseFive.class,AClass.class);
+ Method m = CaseFive.class.getDeclaredMethod("getWithinTypeName",null);
+ String s = (String)m.invoke(instance,null);
+ System.out.println("The aspect instance thinks it is for type name "+s);
+ }
+ }
+}