summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-08-30 17:07:09 +0000
committeracolyer <acolyer>2005-08-30 17:07:09 +0000
commitdca288a38857115c46e83ca2c548377014c42b7d (patch)
treeb9e063c2c0c00e9e2bd50854c790ec96a31dd869
parent3fa3a93b462e19407b015082365b8b9f6b301915 (diff)
downloadaspectj-dca288a38857115c46e83ca2c548377014c42b7d.tar.gz
aspectj-dca288a38857115c46e83ca2c548377014c42b7d.zip
tests for pr107953 and newsgroup reported issue of varargs matching with type variable vararg
-rw-r--r--tests/bugs150/ParameterizedVarArgMatch.aj17
-rw-r--r--tests/bugs150/pr107953.java18
-rw-r--r--tests/java5/ataspectj/ataspectj/misuse/Test019.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java8
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml14
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml4
6 files changed, 60 insertions, 3 deletions
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<E> {
+ public void method1(E...args) {
+ }
+}
+
+public aspect ParameterizedVarArgMatch {
+
+ public static void main(String[] args) {
+ new Test1<String>().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 @@
</compile>
</ajc-test>
+ <ajc-test dir="bugs150" title="varargs with type variable">
+ <compile files="ParameterizedVarArgMatch.aj" options="-1.5">
+ </compile>
+ </ajc-test>
+
+
<ajc-test dir="bugs150" pr="108104" title="multiple anonymous inner classes 2">
<compile files="pr108104.aj" options="-1.5">
</compile>
@@ -155,7 +161,13 @@
<compile files="ShapeCommandMap.java" options="-1.5">
</compile>
</ajc-test>
-
+
+ <ajc-test dir="bugs150/" pr="107953" title="@AfterThrowing with no formal specified">
+ <compile files="pr107953.java" options="-1.5">
+ <message kind="error" line="8" text="throwing formal 'RuntimeException' must be declared as the last parameter in the advice signature"></message>
+ </compile>
+ </ajc-test>
+
<ajc-test dir="bugs150/pr106130" pr="106130" title="test weaving with > 256 locals">
<compile files="AroundLotsOfVars.java LotsOfVars.java" options="-preserveAllLocals"/>
<run class="LotsOfVars">
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 @@
</ajc-test>
<comment>very dirty hack - can't get this location to work properly so added match all error..</comment>
+ <comment>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</comment>
<ajc-test dir="java5/ataspectj"
pr="" title="@AfterReturning with wrong number of args">
<compile files="ataspectj/misuse/Test019.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore">
<message kind="error" line="1" text="the parameter x is not bound"/>
- <message kind="error"/>
+ <message kind="error" line="1" text="formal unbound in pointcut"/>
</compile>
</ajc-test>