aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs1612
diff options
context:
space:
mode:
authoraclement <aclement>2011-06-21 20:10:21 +0000
committeraclement <aclement>2011-06-21 20:10:21 +0000
commit07c850f315070a7c4df63b120b1b54691f7e84c3 (patch)
tree956232f4aa3c71a43d3697348f532844135af498 /tests/bugs1612
parent7dbb9f7d56b887cbd82021d5c3a3c5e8c1f3cfa7 (diff)
downloadaspectj-07c850f315070a7c4df63b120b1b54691f7e84c3.tar.gz
aspectj-07c850f315070a7c4df63b120b1b54691f7e84c3.zip
347395 testcode (not active). 349961 testcode (active)
Diffstat (limited to 'tests/bugs1612')
-rwxr-xr-xtests/bugs1612/pr347395/Target.java16
-rwxr-xr-xtests/bugs1612/pr347395/Task.java9
-rwxr-xr-xtests/bugs1612/pr347395/TaskHistoryAspect.aj38
-rwxr-xr-xtests/bugs1612/pr347395/TaskModification.java13
-rw-r--r--tests/bugs1612/pr349961/A.java7
-rw-r--r--tests/bugs1612/pr349961/ABean.java8
-rw-r--r--tests/bugs1612/pr349961/MyAspect.java20
-rw-r--r--tests/bugs1612/pr349961/MyAspectTest.java23
-rw-r--r--tests/bugs1612/pr349961/MyParameterAnnotation.java13
9 files changed, 147 insertions, 0 deletions
diff --git a/tests/bugs1612/pr347395/Target.java b/tests/bugs1612/pr347395/Target.java
new file mode 100755
index 000000000..ea0faad91
--- /dev/null
+++ b/tests/bugs1612/pr347395/Target.java
@@ -0,0 +1,16 @@
+package xxx.util;
+
+@TaskModification
+public class Target {
+
+ @TaskModification
+ public void m() {
+
+ }
+
+ public static void main(String[] args) {
+
+ new Target().m();
+ }
+
+}
diff --git a/tests/bugs1612/pr347395/Task.java b/tests/bugs1612/pr347395/Task.java
new file mode 100755
index 000000000..d7789cccd
--- /dev/null
+++ b/tests/bugs1612/pr347395/Task.java
@@ -0,0 +1,9 @@
+package xxx.util;
+
+public class Task {
+
+ public Long getId() {
+ return null;
+ }
+
+}
diff --git a/tests/bugs1612/pr347395/TaskHistoryAspect.aj b/tests/bugs1612/pr347395/TaskHistoryAspect.aj
new file mode 100755
index 000000000..d3f8e7603
--- /dev/null
+++ b/tests/bugs1612/pr347395/TaskHistoryAspect.aj
@@ -0,0 +1,38 @@
+package xxx.util;
+
+import java.util.List;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+@Aspect
+public class TaskHistoryAspect {
+
+ @Around("execution(@xxx.util.TaskModification * *.*(..))")
+ public Object aroundModification(ProceedingJoinPoint joinPoint) throws Throwable {
+ Task task = null;
+ List<Task> list = null;
+ for (Object arg : joinPoint.getArgs()) {
+ if (arg instanceof Task) {
+ task = (Task) arg;
+ } else if (arg instanceof List) {
+ list = (List) arg;
+ }
+ }
+ Object result = joinPoint.proceed(joinPoint.getArgs());
+ if (task != null) {
+ logModification(joinPoint, task);
+ } else {
+ logModification(joinPoint, list);
+ }
+ return result;
+ }
+
+ private void logModification(JoinPoint joinPoint, Task task) {
+ }
+
+ private void logModification(JoinPoint joinPoint, List<Task> tasks) {
+ }
+}
diff --git a/tests/bugs1612/pr347395/TaskModification.java b/tests/bugs1612/pr347395/TaskModification.java
new file mode 100755
index 000000000..b4cc96827
--- /dev/null
+++ b/tests/bugs1612/pr347395/TaskModification.java
@@ -0,0 +1,13 @@
+package xxx.util;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TaskModification {
+
+ String value() default "abc";
+
+ int i() default 1;
+
+}
diff --git a/tests/bugs1612/pr349961/A.java b/tests/bugs1612/pr349961/A.java
new file mode 100644
index 000000000..9313fa42f
--- /dev/null
+++ b/tests/bugs1612/pr349961/A.java
@@ -0,0 +1,7 @@
+package com.example;
+
+
+ interface A {
+ public String a(@MyParameterAnnotation String s);
+ }
+
diff --git a/tests/bugs1612/pr349961/ABean.java b/tests/bugs1612/pr349961/ABean.java
new file mode 100644
index 000000000..145609ae3
--- /dev/null
+++ b/tests/bugs1612/pr349961/ABean.java
@@ -0,0 +1,8 @@
+package com.example;
+
+ class ABean implements A {
+ public String a(String s) {
+ return s;
+ }
+ }
+
diff --git a/tests/bugs1612/pr349961/MyAspect.java b/tests/bugs1612/pr349961/MyAspect.java
new file mode 100644
index 000000000..e1e252763
--- /dev/null
+++ b/tests/bugs1612/pr349961/MyAspect.java
@@ -0,0 +1,20 @@
+package com.example;
+
+ import org.aspectj.lang.ProceedingJoinPoint;
+ import org.aspectj.lang.annotation.Around;
+ import org.aspectj.lang.annotation.Aspect;
+ import org.aspectj.lang.annotation.Pointcut;
+
+ @Aspect
+ public class MyAspect {
+
+ @Pointcut("execution(* *(..,@MyParameterAnnotation (String),..))")
+ public void anyMethodCallWithMyParameterAnnotation() {
+ }
+
+ @Around("anyMethodCallWithMyParameterAnnotation()")
+ public Object aroundMethodWithMyParameterAnnotation(ProceedingJoinPoint pjp) throws Throwable {
+ throw new RuntimeException("OK");
+ }
+ }
+
diff --git a/tests/bugs1612/pr349961/MyAspectTest.java b/tests/bugs1612/pr349961/MyAspectTest.java
new file mode 100644
index 000000000..4968cc15d
--- /dev/null
+++ b/tests/bugs1612/pr349961/MyAspectTest.java
@@ -0,0 +1,23 @@
+package com.example;
+
+ public class MyAspectTest {
+
+ public static void main(String []argv) {
+ A a = new ABean();
+ try {
+ if (!a.a("aha").equals("aha")) {
+ throw new IllegalStateException();
+}
+throw new IllegalStateException();
+ //Assert.assertEquals("aha", a.a("aha"));
+ //Assert.fail("Failed due to a weaving problem.");
+ }
+ catch (Exception e) {
+if (!e.getMessage().equals("OK")) {
+throw new IllegalStateException();
+}
+ //Assert.assertEquals("OK", e.getMessage());
+ }
+ }
+ }
+
diff --git a/tests/bugs1612/pr349961/MyParameterAnnotation.java b/tests/bugs1612/pr349961/MyParameterAnnotation.java
new file mode 100644
index 000000000..b87571b9e
--- /dev/null
+++ b/tests/bugs1612/pr349961/MyParameterAnnotation.java
@@ -0,0 +1,13 @@
+ package com.example;
+
+ import java.lang.annotation.ElementType;
+ import java.lang.annotation.Inherited;
+ import java.lang.annotation.Retention;
+ import java.lang.annotation.RetentionPolicy;
+ import java.lang.annotation.Target;
+
+ @Inherited
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.PARAMETER)
+ public @interface MyParameterAnnotation {
+ }