aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Clement <aclement@vmware.com>2025-04-15 15:26:29 -0700
committerAndrew Clement <aclement@vmware.com>2025-04-15 15:26:29 -0700
commit2b0e11d8633c84e8b0827e0eb77b4639fe0914e4 (patch)
tree1a7973c688df646a7d7d6db43d5f7d95c63f3feb /tests
parente0d2b60288f20d00071cf5e0134a31b5758bb006 (diff)
downloadaspectj-master.tar.gz
aspectj-master.zip
Fix more "Attempt to push null on operand stack" variantsHEADmaster
This change fixes more cases in the *Declaration classes that generate code. Both #336 and #337 are due to the same piece of code not correctly computing the resolved position because of copying it from a source method when it needs recomputing for the method being generated. In particular primitive types and/or double slot types (like long or double) cause the code to miscompute the resolved positions or set the wrong type of expected type on the stack. Fixes #336 Fixes #337
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs1924/336/Bang.java17
-rw-r--r--tests/bugs1924/337/X.aj12
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/AllTests19.java4
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1924/Bugs1924Tests.java8
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java4
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml10
6 files changed, 51 insertions, 4 deletions
diff --git a/tests/bugs1924/336/Bang.java b/tests/bugs1924/336/Bang.java
new file mode 100644
index 000000000..276484c51
--- /dev/null
+++ b/tests/bugs1924/336/Bang.java
@@ -0,0 +1,17 @@
+public class Bang {
+
+public static void main(String[] argv) {
+ new Bang().m("a",1,"b");
+}
+
+ public int m(String a, int i, String b) {
+ return 42;
+ }
+
+}
+
+aspect X {
+ int around(String a, int b, String d): execution(* m(..)) && args(a,b,d) {
+ return proceed(a,b,d);
+ }
+}
diff --git a/tests/bugs1924/337/X.aj b/tests/bugs1924/337/X.aj
new file mode 100644
index 000000000..922a6ab67
--- /dev/null
+++ b/tests/bugs1924/337/X.aj
@@ -0,0 +1,12 @@
+public aspect X {
+ pointcut p(long l): call(* F.m(..)) && args(l);
+ Object around (long id): p(id) { return null; }
+
+ public static void main(String []argv) {
+ new F().m(3L);
+ }
+}
+
+class F {
+ public void m(long r) {}
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java
index 494b051e3..b19cddff1 100644
--- a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java
+++ b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java
@@ -15,6 +15,7 @@ import org.aspectj.systemtest.ajc1920.AllTestsAspectJ1920;
import org.aspectj.systemtest.ajc1921.AllTestsAspectJ1921;
import org.aspectj.systemtest.ajc1922.AllTestsAspectJ1922;
import org.aspectj.systemtest.ajc1923.AllTestsAspectJ1923;
+import org.aspectj.systemtest.ajc1924.AllTestsAspectJ1924;
import org.aspectj.systemtest.ajc193.AllTestsAspectJ193;
import org.aspectj.systemtest.ajc195.AllTestsAspectJ195;
import org.aspectj.systemtest.ajc196.AllTestsAspectJ196;
@@ -47,8 +48,9 @@ public class AllTests19 {
suite.addTest(AllTestsAspectJ1920.suite());
suite.addTest(AllTestsAspectJ1921.suite());
suite.addTest(AllTestsAspectJ1922.suite());
- // AspectJ_JDK_Update
suite.addTest(AllTestsAspectJ1923.suite());
+ // AspectJ_JDK_Update
+ suite.addTest(AllTestsAspectJ1924.suite());
suite.addTest(AllTests18.suite());
// $JUnit-END$
return suite;
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1924/Bugs1924Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Bugs1924Tests.java
index e186993b2..aeb283c02 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1924/Bugs1924Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Bugs1924Tests.java
@@ -21,6 +21,14 @@ public class Bugs1924Tests extends XMLBasedAjcTestCase {
public void testNothing() {
}
+
+ public void testGh336_ProceedCodeGenProblem() {
+ runTest("proceed code gen problem 1");
+ }
+
+ public void testGh337_ProceedCodeGenProblem() {
+ runTest("proceed code gen problem 2");
+ }
@Override
protected java.net.URL getSpecFile() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java
index 3e95d587e..1143e604c 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java
@@ -25,9 +25,7 @@ public class Java24PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTe
return XMLBasedAjcTestCase.loadSuite(Java24PreviewFeaturesTests.class);
}
- public void testJep455PrimitivePatternsSwitch1() {
- fail();
-// runTest("primitive types patterns - switch");
+ public void testNothing() {
}
@Override
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml
index 137932609..000719f38 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml
@@ -45,5 +45,15 @@
</run>
</ajc-test>
+ <ajc-test dir="bugs1924/336" vm="24" title="proceed code gen problem 1">
+ <compile files="Bang.java" options="-17"/>
+ <run class="Bang"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs1924/337" vm="24" title="proceed code gen problem 2">
+ <compile files="X.aj" options="-17"/>
+ <run class="X"/>
+ </ajc-test>
+
</suite>