]> source.dussan.org Git - aspectj.git/commitdiff
347395 testcode (not active). 349961 testcode (active)
authoraclement <aclement>
Tue, 21 Jun 2011 20:10:21 +0000 (20:10 +0000)
committeraclement <aclement>
Tue, 21 Jun 2011 20:10:21 +0000 (20:10 +0000)
tests/bugs1612/pr347395/Target.java [new file with mode: 0755]
tests/bugs1612/pr347395/Task.java [new file with mode: 0755]
tests/bugs1612/pr347395/TaskHistoryAspect.aj [new file with mode: 0755]
tests/bugs1612/pr347395/TaskModification.java [new file with mode: 0755]
tests/bugs1612/pr349961/A.java [new file with mode: 0644]
tests/bugs1612/pr349961/ABean.java [new file with mode: 0644]
tests/bugs1612/pr349961/MyAspect.java [new file with mode: 0644]
tests/bugs1612/pr349961/MyAspectTest.java [new file with mode: 0644]
tests/bugs1612/pr349961/MyParameterAnnotation.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java
tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml

diff --git a/tests/bugs1612/pr347395/Target.java b/tests/bugs1612/pr347395/Target.java
new file mode 100755 (executable)
index 0000000..ea0faad
--- /dev/null
@@ -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 (executable)
index 0000000..d7789cc
--- /dev/null
@@ -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 (executable)
index 0000000..d3f8e76
--- /dev/null
@@ -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 (executable)
index 0000000..b4cc968
--- /dev/null
@@ -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 (file)
index 0000000..9313fa4
--- /dev/null
@@ -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 (file)
index 0000000..145609a
--- /dev/null
@@ -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 (file)
index 0000000..e1e2527
--- /dev/null
@@ -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 (file)
index 0000000..4968cc1
--- /dev/null
@@ -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 (file)
index 0000000..b87571b
--- /dev/null
@@ -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 {
+ }
index b23bce8917550cc64e6030ad1377efc8fb2a6ba5..b3190ef0a3d9505b7d89117314b76bc35f4c20cd 100644 (file)
@@ -25,6 +25,19 @@ public class Ajc1612Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        // runTest("anno copying");
        // }
 
+       public void testOrdering_pr349961() {
+               runTest("ordering");
+       }
+
+       public void testOrdering_pr349961_2() {
+               runTest("ordering - 2");
+       }
+/*
+       public void testVerifyError_pr347395() {
+               runTest("verifyerror - inline");
+       }
+       */
+
        public void testDuplicateMethods_349398() {
                runTest("duplicate methods");
        }
index eddffe1072daddf74928ed92eb1b1897facf8bce..25e7c8c740e4480d5cc2502d8a31f1c84072ce31 100644 (file)
@@ -2,6 +2,24 @@
 
 <suite>
 
+<ajc-test dir="bugs1612/pr349961" title="ordering">
+<compile files="MyParameterAnnotation.java MyAspect.java MyAspectTest.java A.java ABean.java" options="-1.5"/>
+<run class="com.example.MyAspectTest">
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr349961" title="ordering - 2">
+<compile files="MyParameterAnnotation.java MyAspect.java MyAspectTest.java ABean.java A.java" options="-1.5"/>
+<run class="com.example.MyAspectTest">
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr347395" title="verifyerror - inline">
+<compile files="Target.java Task.java TaskHistoryAspect.aj TaskModification.java" options="-1.5"/>
+<run class="xxx.util.Target">
+</run>
+</ajc-test>
+
 <ajc-test dir="bugs1612/pr349398" title="duplicate methods">
 <compile files="DataGenerator.java CacheAspect.java DataGeneratorCacheAspect.java DataGeneratorTest.java" options="-1.5"/>
 <run class="DataGeneratorTest">