aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2005-05-06 10:21:26 +0000
committeraclement <aclement>2005-05-06 10:21:26 +0000
commit7389d9fc0252b90a9b0bf2cb1861a0f3802ad320 (patch)
treeef22d67aa16d9c996dd08cdcc55e131cf6bf94d7 /tests
parent87f211f62cd0af7b74d9d00123e736941f015fee (diff)
downloadaspectj-7389d9fc0252b90a9b0bf2cb1861a0f3802ad320.tar.gz
aspectj-7389d9fc0252b90a9b0bf2cb1861a0f3802ad320.zip
Fix for pr91267 (Generics): NPE at EclipseFactory.java:143 when using generic methods in aspects
Diffstat (limited to 'tests')
-rw-r--r--tests/java5/generics/bugs/pr91267/TestBug1.aj15
-rw-r--r--tests/java5/generics/bugs/pr91267/TestBug2.aj13
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java8
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml10
4 files changed, 46 insertions, 0 deletions
diff --git a/tests/java5/generics/bugs/pr91267/TestBug1.aj b/tests/java5/generics/bugs/pr91267/TestBug1.aj
new file mode 100644
index 000000000..b861d2155
--- /dev/null
+++ b/tests/java5/generics/bugs/pr91267/TestBug1.aj
@@ -0,0 +1,15 @@
+import java.util.*;
+
+public aspect TestBug1 {
+ static <T> void addToEnv(Map<String,T> env, String key, T value) {
+ env.put(key, value);
+ }
+
+ public static void main(String[] argv) {
+ Map<String,Integer> msi = new HashMap<String,Integer>();
+ addToEnv(msi,"andy",new Integer(42));
+
+ if (msi.get("andy")!=42) throw new RuntimeException("Failed to add");
+ }
+}
+
diff --git a/tests/java5/generics/bugs/pr91267/TestBug2.aj b/tests/java5/generics/bugs/pr91267/TestBug2.aj
new file mode 100644
index 000000000..840f769ee
--- /dev/null
+++ b/tests/java5/generics/bugs/pr91267/TestBug2.aj
@@ -0,0 +1,13 @@
+import java.util.*;
+
+public aspect TestBug2 {
+ static <T> T lookupEnv(Map<String,T> env, String key) {
+ return env.get(key);
+ }
+
+ public static void main(String[] argv) {
+ Map<String,Integer> msi = new HashMap<String,Integer>();
+ msi.put("andy",42);
+ if (lookupEnv(msi,"andy")!=42) throw new RuntimeException("Failed to lookup");
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index 332f0dd8e..96557dfe5 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -19,4 +19,12 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testITDReturningParameterizedType() {
runTest("ITD with parameterized type");
}
+
+ public void testPR91267_1() {
+ runTest("NPE using generic methods in aspects 1");
+ }
+
+ public void testPR91267_2() {
+ runTest("NPE using generic methods in aspects 2");
+ }
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 8001d474a..8dca8410f 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -2154,5 +2154,15 @@
<compile files="Test3.java" options="-1.5"/>
<run class="Test3"/>
</ajc-test>
+
+ <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 1" vm="1.5">
+ <compile files="TestBug1.aj" options="-1.5"/>
+ <run class="TestBug1"/>
+ </ajc-test>
+
+ <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 2" vm="1.5">
+ <compile files="TestBug2.aj" options="-1.5"/>
+ <run class="TestBug2"/>
+ </ajc-test>
</suite> \ No newline at end of file