From 07c850f315070a7c4df63b120b1b54691f7e84c3 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 21 Jun 2011 20:10:21 +0000 Subject: [PATCH] 347395 testcode (not active). 349961 testcode (active) --- tests/bugs1612/pr347395/Target.java | 16 ++++++++ tests/bugs1612/pr347395/Task.java | 9 +++++ tests/bugs1612/pr347395/TaskHistoryAspect.aj | 38 +++++++++++++++++++ tests/bugs1612/pr347395/TaskModification.java | 13 +++++++ tests/bugs1612/pr349961/A.java | 7 ++++ tests/bugs1612/pr349961/ABean.java | 8 ++++ tests/bugs1612/pr349961/MyAspect.java | 20 ++++++++++ tests/bugs1612/pr349961/MyAspectTest.java | 23 +++++++++++ .../pr349961/MyParameterAnnotation.java | 13 +++++++ .../systemtest/ajc1612/Ajc1612Tests.java | 13 +++++++ .../aspectj/systemtest/ajc1612/ajc1612.xml | 18 +++++++++ 11 files changed, 178 insertions(+) create mode 100755 tests/bugs1612/pr347395/Target.java create mode 100755 tests/bugs1612/pr347395/Task.java create mode 100755 tests/bugs1612/pr347395/TaskHistoryAspect.aj create mode 100755 tests/bugs1612/pr347395/TaskModification.java create mode 100644 tests/bugs1612/pr349961/A.java create mode 100644 tests/bugs1612/pr349961/ABean.java create mode 100644 tests/bugs1612/pr349961/MyAspect.java create mode 100644 tests/bugs1612/pr349961/MyAspectTest.java create mode 100644 tests/bugs1612/pr349961/MyParameterAnnotation.java 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 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 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 { + } diff --git a/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java b/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java index b23bce891..b3190ef0a 100644 --- a/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java @@ -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"); } diff --git a/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml b/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml index eddffe107..25e7c8c74 100644 --- a/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml +++ b/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml @@ -2,6 +2,24 @@ + + + + + + + + + + + + + + + + + + -- 2.39.5