diff options
author | aclement <aclement> | 2007-11-08 15:33:36 +0000 |
---|---|---|
committer | aclement <aclement> | 2007-11-08 15:33:36 +0000 |
commit | 6ae7fbf008528f4c24b2d63933ee4504a64164c7 (patch) | |
tree | 6957556592866c8299bd25442594be51945de983 /tests/bugs154 | |
parent | 5aced374f29c70db5af2730672bc0d14dfa58df2 (diff) | |
download | aspectj-6ae7fbf008528f4c24b2d63933ee4504a64164c7.tar.gz aspectj-6ae7fbf008528f4c24b2d63933ee4504a64164c7.zip |
tests for 148381
Diffstat (limited to 'tests/bugs154')
27 files changed, 232 insertions, 0 deletions
diff --git a/tests/bugs154/pr148381/error1/META-INF/aop.xml b/tests/bugs154/pr148381/error1/META-INF/aop.xml new file mode 100644 index 000000000..942caa29e --- /dev/null +++ b/tests/bugs154/pr148381/error1/META-INF/aop.xml @@ -0,0 +1,5 @@ +<aspectj> + <aspects> + <aspect name="test.Monitor"/> + </aspects> +</aspectj> diff --git a/tests/bugs154/pr148381/error1/Main.java b/tests/bugs154/pr148381/error1/Main.java new file mode 100644 index 000000000..16aef2686 --- /dev/null +++ b/tests/bugs154/pr148381/error1/Main.java @@ -0,0 +1,12 @@ +package test; + +public class Main { + public static void main(String[] args) { + new Main().foo(); + } + + @PerformanceMonitor(expected=1000) + public void foo() { + + } +} diff --git a/tests/bugs154/pr148381/error1/Monitor.java b/tests/bugs154/pr148381/error1/Monitor.java new file mode 100644 index 000000000..540faa807 --- /dev/null +++ b/tests/bugs154/pr148381/error1/Monitor.java @@ -0,0 +1,29 @@ +package test; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +class Monitor { + @Pointcut(value="execution(@PerformanceMonitor * *(..)) && @annotation(monitoringAnnot)", argNames="monitoringAnnot") + public void monitored(PerformanceMonitor monitoringAnnot) {} + + // Not enough entries in argNames + @Around(value="monitored(monitoringAnnot)", argNames="pjp") + public Object flagExpectationMismatch(ProceedingJoinPoint pjp, PerformanceMonitor monitoringAnnot) throws Throwable { + //long start = System.nanoTime(); + Object ret = pjp.proceed(); + //long end = System.nanoTime(); + + //if(end - start > monitoringAnnot.expected()) { + // System.out.println("Method " + pjp.getSignature().toShortString() + " took longer than expected\n\t" + // + "Max expected = " + monitoringAnnot.expected() + ", actual = " + (end-start)); + //} + + System.out.println("This method was intercepted by the advice: "+pjp.getSignature().toShortString()); + return ret; + } +} + diff --git a/tests/bugs154/pr148381/error1/PerformanceMonitor.java b/tests/bugs154/pr148381/error1/PerformanceMonitor.java new file mode 100644 index 000000000..e9f6aa3b2 --- /dev/null +++ b/tests/bugs154/pr148381/error1/PerformanceMonitor.java @@ -0,0 +1,9 @@ +package test; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@interface PerformanceMonitor { + public int expected(); +} diff --git a/tests/bugs154/pr148381/error1/code.jar b/tests/bugs154/pr148381/error1/code.jar Binary files differnew file mode 100644 index 000000000..6852cb874 --- /dev/null +++ b/tests/bugs154/pr148381/error1/code.jar diff --git a/tests/bugs154/pr148381/error1/readme b/tests/bugs154/pr148381/error1/readme new file mode 100644 index 000000000..1ea0ea5fd --- /dev/null +++ b/tests/bugs154/pr148381/error1/readme @@ -0,0 +1,2 @@ +Error scenario one +- incorrect number of 'names' in argNames compared the method it is attached to diff --git a/tests/bugs154/pr148381/error1/rebuild.sh b/tests/bugs154/pr148381/error1/rebuild.sh new file mode 100755 index 000000000..5cb9a02eb --- /dev/null +++ b/tests/bugs154/pr148381/error1/rebuild.sh @@ -0,0 +1,2 @@ +javac *.java -d . +jar -cvMf code.jar test diff --git a/tests/bugs154/pr148381/error2/META-INF/aop.xml b/tests/bugs154/pr148381/error2/META-INF/aop.xml new file mode 100644 index 000000000..942caa29e --- /dev/null +++ b/tests/bugs154/pr148381/error2/META-INF/aop.xml @@ -0,0 +1,5 @@ +<aspectj> + <aspects> + <aspect name="test.Monitor"/> + </aspects> +</aspectj> diff --git a/tests/bugs154/pr148381/error2/Main.java b/tests/bugs154/pr148381/error2/Main.java new file mode 100644 index 000000000..16aef2686 --- /dev/null +++ b/tests/bugs154/pr148381/error2/Main.java @@ -0,0 +1,12 @@ +package test; + +public class Main { + public static void main(String[] args) { + new Main().foo(); + } + + @PerformanceMonitor(expected=1000) + public void foo() { + + } +} diff --git a/tests/bugs154/pr148381/error2/Monitor.java b/tests/bugs154/pr148381/error2/Monitor.java new file mode 100644 index 000000000..180e10b9b --- /dev/null +++ b/tests/bugs154/pr148381/error2/Monitor.java @@ -0,0 +1,29 @@ +package test; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +class Monitor { + @Pointcut(value="execution(@PerformanceMonitor * *(..)) && @annotation(monitoringAnnot)", argNames="monitoringAnnot") + public void monitored(PerformanceMonitor monitoringAnnot) {} + + // Not enough entries in argNames + @Around(value="monitored(monitoringAnnot)", argNames="") + public Object flagExpectationMismatch(ProceedingJoinPoint pjp, PerformanceMonitor monitoringAnnot) throws Throwable { + //long start = System.nanoTime(); + Object ret = pjp.proceed(); + //long end = System.nanoTime(); + + //if(end - start > monitoringAnnot.expected()) { + // System.out.println("Method " + pjp.getSignature().toShortString() + " took longer than expected\n\t" + // + "Max expected = " + monitoringAnnot.expected() + ", actual = " + (end-start)); + //} + + System.out.println("This method was intercepted by the advice: "+pjp.getSignature().toShortString()); + return ret; + } +} + diff --git a/tests/bugs154/pr148381/error2/PerformanceMonitor.java b/tests/bugs154/pr148381/error2/PerformanceMonitor.java new file mode 100644 index 000000000..e9f6aa3b2 --- /dev/null +++ b/tests/bugs154/pr148381/error2/PerformanceMonitor.java @@ -0,0 +1,9 @@ +package test; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@interface PerformanceMonitor { + public int expected(); +} diff --git a/tests/bugs154/pr148381/error2/code.jar b/tests/bugs154/pr148381/error2/code.jar Binary files differnew file mode 100644 index 000000000..6c01b77f5 --- /dev/null +++ b/tests/bugs154/pr148381/error2/code.jar diff --git a/tests/bugs154/pr148381/error2/readme b/tests/bugs154/pr148381/error2/readme new file mode 100644 index 000000000..7b4e58391 --- /dev/null +++ b/tests/bugs154/pr148381/error2/readme @@ -0,0 +1,2 @@ +Error scenario two +- blank argNames supplied diff --git a/tests/bugs154/pr148381/error2/rebuild.sh b/tests/bugs154/pr148381/error2/rebuild.sh new file mode 100755 index 000000000..5cb9a02eb --- /dev/null +++ b/tests/bugs154/pr148381/error2/rebuild.sh @@ -0,0 +1,2 @@ +javac *.java -d . +jar -cvMf code.jar test diff --git a/tests/bugs154/pr148381/error3/META-INF/aop.xml b/tests/bugs154/pr148381/error3/META-INF/aop.xml new file mode 100644 index 000000000..942caa29e --- /dev/null +++ b/tests/bugs154/pr148381/error3/META-INF/aop.xml @@ -0,0 +1,5 @@ +<aspectj> + <aspects> + <aspect name="test.Monitor"/> + </aspects> +</aspectj> diff --git a/tests/bugs154/pr148381/error3/Main.java b/tests/bugs154/pr148381/error3/Main.java new file mode 100644 index 000000000..16aef2686 --- /dev/null +++ b/tests/bugs154/pr148381/error3/Main.java @@ -0,0 +1,12 @@ +package test; + +public class Main { + public static void main(String[] args) { + new Main().foo(); + } + + @PerformanceMonitor(expected=1000) + public void foo() { + + } +} diff --git a/tests/bugs154/pr148381/error3/Monitor.java b/tests/bugs154/pr148381/error3/Monitor.java new file mode 100644 index 000000000..de51569c2 --- /dev/null +++ b/tests/bugs154/pr148381/error3/Monitor.java @@ -0,0 +1,23 @@ +package test; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.*; + +class Foo {} + +@Aspect +class Monitor { + @Around(value="execution(* *(..))",argNames="") + public void b(Foo aa) {} + @Pointcut(value="execution(* *(..))",argNames="") + public void a(Foo aa) {} + @Before(value="execution(* *(..))",argNames="") + public void c(Foo aa) {} + @After(value="execution(* *(..))",argNames="a,b,c") + public void d(Foo aa) {} + @AfterThrowing(value="execution(* *(..))",argNames="") + public void e(Foo aa) {} + @AfterReturning(value="execution(* *(..))",argNames="") + public void f(Foo aa) {} +} + diff --git a/tests/bugs154/pr148381/error3/PerformanceMonitor.java b/tests/bugs154/pr148381/error3/PerformanceMonitor.java new file mode 100644 index 000000000..e9f6aa3b2 --- /dev/null +++ b/tests/bugs154/pr148381/error3/PerformanceMonitor.java @@ -0,0 +1,9 @@ +package test; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@interface PerformanceMonitor { + public int expected(); +} diff --git a/tests/bugs154/pr148381/error3/code.jar b/tests/bugs154/pr148381/error3/code.jar Binary files differnew file mode 100644 index 000000000..91e15cf6f --- /dev/null +++ b/tests/bugs154/pr148381/error3/code.jar diff --git a/tests/bugs154/pr148381/error3/readme b/tests/bugs154/pr148381/error3/readme new file mode 100644 index 000000000..213f7dc0b --- /dev/null +++ b/tests/bugs154/pr148381/error3/readme @@ -0,0 +1,2 @@ +Error scenario two +- wrong argNames for multiple pieces of advice diff --git a/tests/bugs154/pr148381/error3/rebuild.sh b/tests/bugs154/pr148381/error3/rebuild.sh new file mode 100755 index 000000000..5cb9a02eb --- /dev/null +++ b/tests/bugs154/pr148381/error3/rebuild.sh @@ -0,0 +1,2 @@ +javac *.java -d . +jar -cvMf code.jar test diff --git a/tests/bugs154/pr148381/readme b/tests/bugs154/pr148381/readme new file mode 100644 index 000000000..51cfb57a1 --- /dev/null +++ b/tests/bugs154/pr148381/readme @@ -0,0 +1,7 @@ +rebuilding code.jar is done with: + +javac *.java +jar -cvMf code.jar test + +Basically you need to ensure the classes have no local variable tables - that is the default behaviour for javac + diff --git a/tests/bugs154/pr148381/simple/META-INF/aop.xml b/tests/bugs154/pr148381/simple/META-INF/aop.xml new file mode 100644 index 000000000..942caa29e --- /dev/null +++ b/tests/bugs154/pr148381/simple/META-INF/aop.xml @@ -0,0 +1,5 @@ +<aspectj> + <aspects> + <aspect name="test.Monitor"/> + </aspects> +</aspectj> diff --git a/tests/bugs154/pr148381/simple/Main.java b/tests/bugs154/pr148381/simple/Main.java new file mode 100644 index 000000000..16aef2686 --- /dev/null +++ b/tests/bugs154/pr148381/simple/Main.java @@ -0,0 +1,12 @@ +package test; + +public class Main { + public static void main(String[] args) { + new Main().foo(); + } + + @PerformanceMonitor(expected=1000) + public void foo() { + + } +} diff --git a/tests/bugs154/pr148381/simple/Monitor.java b/tests/bugs154/pr148381/simple/Monitor.java new file mode 100644 index 000000000..fdba651ce --- /dev/null +++ b/tests/bugs154/pr148381/simple/Monitor.java @@ -0,0 +1,28 @@ +package test; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +class Monitor { + @Pointcut(value="execution(@PerformanceMonitor * *(..)) && @annotation(monitoringAnnot)", argNames="monitoringAnnot") + public void monitored(PerformanceMonitor monitoringAnnot) {} + + @Around(value="monitored(monitoringAnnot)", argNames="pjp, monitoringAnnot") + public Object flagExpectationMismatch(ProceedingJoinPoint pjp, PerformanceMonitor monitoringAnnot) throws Throwable { + //long start = System.nanoTime(); + Object ret = pjp.proceed(); + //long end = System.nanoTime(); + + //if(end - start > monitoringAnnot.expected()) { + // System.out.println("Method " + pjp.getSignature().toShortString() + " took longer than expected\n\t" + // + "Max expected = " + monitoringAnnot.expected() + ", actual = " + (end-start)); + //} + + System.out.println("This method was intercepted by the advice: "+pjp.getSignature().toShortString()); + return ret; + } +} + diff --git a/tests/bugs154/pr148381/simple/PerformanceMonitor.java b/tests/bugs154/pr148381/simple/PerformanceMonitor.java new file mode 100644 index 000000000..e9f6aa3b2 --- /dev/null +++ b/tests/bugs154/pr148381/simple/PerformanceMonitor.java @@ -0,0 +1,9 @@ +package test; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@interface PerformanceMonitor { + public int expected(); +} diff --git a/tests/bugs154/pr148381/simple/code.jar b/tests/bugs154/pr148381/simple/code.jar Binary files differnew file mode 100644 index 000000000..4a30b29a1 --- /dev/null +++ b/tests/bugs154/pr148381/simple/code.jar |