From dca288a38857115c46e83ca2c548377014c42b7d Mon Sep 17 00:00:00 2001 From: acolyer Date: Tue, 30 Aug 2005 17:07:09 +0000 Subject: tests for pr107953 and newsgroup reported issue of varargs matching with type variable vararg --- tests/bugs150/ParameterizedVarArgMatch.aj | 17 +++++++++++++++++ tests/bugs150/pr107953.java | 18 ++++++++++++++++++ tests/java5/ataspectj/ataspectj/misuse/Test019.java | 2 +- .../src/org/aspectj/systemtest/ajc150/Ajc150Tests.java | 8 ++++++++ tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 14 +++++++++++++- .../org/aspectj/systemtest/ajc150/ataspectj/misuse.xml | 4 +++- 6 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 tests/bugs150/ParameterizedVarArgMatch.aj create mode 100644 tests/bugs150/pr107953.java (limited to 'tests') diff --git a/tests/bugs150/ParameterizedVarArgMatch.aj b/tests/bugs150/ParameterizedVarArgMatch.aj new file mode 100644 index 000000000..5f0bf3f44 --- /dev/null +++ b/tests/bugs150/ParameterizedVarArgMatch.aj @@ -0,0 +1,17 @@ +class Test1 { + public void method1(E...args) { + } +} + +public aspect ParameterizedVarArgMatch { + + public static void main(String[] args) { + new Test1().method1("a","b","c"); + } + + + after(Test1 test1, Object[] arg) returning: + execution(* Test1.method1(Object...)) && target(test1) && args(arg) { + System.out.println("got here"); + } +} \ No newline at end of file diff --git a/tests/bugs150/pr107953.java b/tests/bugs150/pr107953.java new file mode 100644 index 000000000..8e42817c1 --- /dev/null +++ b/tests/bugs150/pr107953.java @@ -0,0 +1,18 @@ +import java.lang.annotation.*; +import org.aspectj.lang.annotation.*; + +@Aspect +public class pr107953 { + + @AfterThrowing(pointcut="execution(* Foo.*(..))",throwing="RuntimeException") + public void missingBindingOfThrowingFormal() { + System.out.println("failure"); + } + +} + +class Foo { + void bar() { + throw new RuntimeException(); + } +} \ No newline at end of file diff --git a/tests/java5/ataspectj/ataspectj/misuse/Test019.java b/tests/java5/ataspectj/ataspectj/misuse/Test019.java index 301c3de35..39f516730 100644 --- a/tests/java5/ataspectj/ataspectj/misuse/Test019.java +++ b/tests/java5/ataspectj/ataspectj/misuse/Test019.java @@ -6,6 +6,6 @@ import org.aspectj.lang.annotation.*; @Aspect public class Test019 { @AfterReturning(value="call(* *..*(..))",returning="f") - public void itsAFoo(Object f, int x) { + public void itsAFoo(int x, Object f) { } } diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index aba91b617..5d1ff7d8c 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -298,6 +298,14 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("inner types and type variables"); } + public void testAtAfterThrowingWithNoFormal() { + runTest("@AfterThrowing with no formal specified"); + } + + public void testParameterizedVarArgsMatch() { + runTest("varargs with type variable"); + } + // helper methods..... public SyntheticRepository createRepos(File cpentry) { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index ca204a231..a75e46b07 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -133,6 +133,12 @@ + + + + + + @@ -155,7 +161,13 @@ - + + + + + + + diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml index d0204141a..9aec9d7a4 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml @@ -55,11 +55,13 @@ very dirty hack - can't get this location to work properly so added match all error.. + amc - with new checks for binding of returning this was giving a different message, so I + tweaked the test slightly by swapping the order of the args - + -- cgit v1.2.3