--- /dev/null
+package xxx.util;
+
+@TaskModification
+public class Target {
+
+ @TaskModification
+ public void m() {
+
+ }
+
+ public static void main(String[] args) {
+
+ new Target().m();
+ }
+
+}
--- /dev/null
+package xxx.util;
+
+public class Task {
+
+ public Long getId() {
+ return null;
+ }
+
+}
--- /dev/null
+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) {
+ }
+}
--- /dev/null
+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;
+
+}
--- /dev/null
+package com.example;
+
+
+ interface A {
+ public String a(@MyParameterAnnotation String s);
+ }
+
--- /dev/null
+package com.example;
+
+ class ABean implements A {
+ public String a(String s) {
+ return s;
+ }
+ }
+
--- /dev/null
+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");
+ }
+ }
+
--- /dev/null
+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());
+ }
+ }
+ }
+
--- /dev/null
+ 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 {
+ }
// 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");
}
<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">