]> source.dussan.org Git - aspectj.git/commitdiff
Switch to Java 22 + add basic test suite
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Fri, 22 Mar 2024 19:53:10 +0000 (20:53 +0100)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Sat, 23 Mar 2024 19:22:39 +0000 (20:22 +0100)
The tests from Java 21 were copied to 22. Inactive ones were activated
after their features under test were fixed/implemented. Preview ones
were promotes to final ones for unnamed variables and patterns.

TODO: Add tests for new Java 22 features and maybe adjust or
amend existing feature tests, if preview or final characteristics have
changed since Java 21.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
16 files changed:
docs/devguide/ajc.adoc
docs/release/README-1.9.21.adoc
org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java
tests/features1921/java21/UnnamedPatternsPreview1Aspect.aj
tests/src/test/java/org/aspectj/systemtest/AllTests19.java
tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java
tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java
tests/src/test/java/org/aspectj/systemtest/ajc1922/Ajc1922TestsJava.java [new file with mode: 0644]
tests/src/test/java/org/aspectj/systemtest/ajc1922/AllTestsAspectJ1922.java [new file with mode: 0644]
tests/src/test/java/org/aspectj/systemtest/ajc1922/Bugs1922Tests.java [new file with mode: 0644]
tests/src/test/java/org/aspectj/systemtest/ajc1922/Java22PreviewFeaturesTests.java [new file with mode: 0644]
tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java [new file with mode: 0644]
tests/src/test/resources/org/aspectj/systemtest/ajc1921/ajc1921.xml
tests/src/test/resources/org/aspectj/systemtest/ajc1922/ajc1922.xml [new file with mode: 0644]
tests/src/test/resources/org/aspectj/systemtest/ajc1922/sanity-tests-22.xml [new file with mode: 0644]

index 72f2112b6a02eca7c623c3b14312c77c4cdb8d5d..578c9ce6ca12a758dc89ebc76ceb9e98535740bd 100644 (file)
@@ -178,11 +178,11 @@ Limitations which apply to both LTW and CTW modes include:
   <Directory> defaults to the current working dir.
 
 // AspectJ_JDK_Update: increment max. version and, if necessary, min. version
-`-source <[1.3 to 21]>`::
+`-source <[1.3 to 22]>`::
   Set source file Java language level
-`-target <[1.3 to 21]>`::
+`-target <[1.3 to 22]>`::
   Set classfile Java bytecode level
-`-<[1.3 to 21]>`::
+`-<[1.3 to 22]>`::
   Set compiler compliance level. Implies identical `-source` and `-target` levels.
   E.g., `-11` implies `-source 11` and `-target 11`.
 
index a3bfc53948e4a5b09ca9169df808112a3659bf20..48a35cbe0954cbc3fa51da752fc6b9c0ff9f73ef 100644 (file)
@@ -2,9 +2,6 @@
 :doctype: book
 :leveloffset: +1
 
-// AspectJ_JDK_Update: Each a.b.c release needs a new release notes document. For a.b.c.d minors, the existing a.b.c
-// document can be updated. After copying this document, remove the comment from the previous one.
-
 The releases 1.9.21, 1.9.21.1 and 1.9.21.2 are described together in this document.
 
 = AspectJ 1.9.21.2
index 7be4422ea368f81d79bf07772e1a433f7acc9b6b..1851bb076f54692ecbbafdb28b7d5e770dfde846 100644 (file)
@@ -1,7 +1,7 @@
 compiler.name = AspectJ Compiler
 # AspectJ_JDK_Update: Update not only for new Java versions, but each time JDT Core is updated with an upstream merge.
 # Always make sure to update to the latest merge commit ID and date of the latest upstream commit.
-compiler.version = Eclipse Compiler 8398f6c1210ec3 (13Feb2024) - Java21
+compiler.version = Eclipse Compiler b2705b00e91be7 (20Mar2024) - Java22
 compiler.copyright =
 
 misc.version = {0} {1} - {2} {3}
index d6b938b5c14594fd3b7c5ae394a947004bdb6645..69689b8d913ed31b904a6605c6d0847b8df29401 100644 (file)
@@ -253,7 +253,7 @@ public class AjcTask extends MatchingTask {
        // AspectJ_JDK_Update: Check minimum supported ECJ version, currently 1.3
        public static final int JAVA_VERSION_MIN = 3;
        // AspectJ_JDK_Update: Check maximum supported ECJ version
-       public static final int JAVA_VERSION_MAX = 21;
+       public static final int JAVA_VERSION_MAX = 22;
 
        static final String[] SOURCE_INPUTS;
        static final String[] TARGET_INPUTS;
index d224a94fcb3a34a7dcac3c6541bdf04591ba9473..ebe655f7ba3c74a0e3f26e01b34f20f17a6d0635 100644 (file)
@@ -8,7 +8,7 @@ import java.util.stream.Stream;
 /**
  * Examples taken from <a href="https://openjdk.org/jeps/443">JEP 443</a>
  */
-public class UnnamedPatternsPreview1Aspect {
+public aspect UnnamedPatternsPreview1Aspect {
   public static void main(String[] args) {}
 
   before() : execution(* main(String[])) {
index 665569ec7f177efa84ab02d4728c10341caa749f..7d8b11c1e516a1bc233d843e55cc4a20695aab2d 100644 (file)
@@ -13,6 +13,7 @@ import org.aspectj.systemtest.ajc1919.AllTestsAspectJ1919;
 import org.aspectj.systemtest.ajc192.AllTestsAspectJ192;
 import org.aspectj.systemtest.ajc1920.AllTestsAspectJ1920;
 import org.aspectj.systemtest.ajc1921.AllTestsAspectJ1921;
+import org.aspectj.systemtest.ajc1922.AllTestsAspectJ1922;
 import org.aspectj.systemtest.ajc193.AllTestsAspectJ193;
 import org.aspectj.systemtest.ajc195.AllTestsAspectJ195;
 import org.aspectj.systemtest.ajc196.AllTestsAspectJ196;
@@ -43,8 +44,9 @@ public class AllTests19 {
                suite.addTest(AllTestsAspectJ199.suite());
                suite.addTest(AllTestsAspectJ1919.suite());
                suite.addTest(AllTestsAspectJ1920.suite());
-               // AspectJ_JDK_Update
                suite.addTest(AllTestsAspectJ1921.suite());
+               // AspectJ_JDK_Update
+               suite.addTest(AllTestsAspectJ1922.suite());
                suite.addTest(AllTests18.suite());
                // $JUnit-END$
                return suite;
index a8166995b96e1ceac1d1b0e1ad41d3c0a850bb2d..8fd5b4514ebb70cb75c8ffac03a1038452052911 100644 (file)
@@ -12,18 +12,6 @@ import junit.framework.TestSuite;
 import org.aspectj.tools.ant.taskdefs.AjcTask;
 import org.aspectj.util.LangUtil;
 
-// AspectJ_JDK_Update
-//  - Copy 'ajc*' package with all classes to a new package, incrementing the version number in the package
-//  - Rename all classes, incrementing version numbers
-//  - Add this class to the suite in class AllTests19
-//  - Increment version numbers in strings, method calls and constants to the appropriate values, creating necessary
-//    methods and constants classes providing them, if they do not exist yet
-//  - Also increment references to 'ajc*.xml' and 'sanity-tests-*.xml' test definition, copying the previous
-//    tests/src/test/resources/org/aspectj/systemtest/ajc* directory, incrementing all names and adjusting the XML
-//    file contents appropriately
-//  - Search for other 'AspectJ_JDK_Update' hints in the repository, also performing the necessary to-dos there
-//  - Remove this comment from the previous class version after copying this one
-
 /**
  * @author Alexander Kriegisch
  */
index 2fd5e8ef8344f45d638aab8928e10496911c5c43..086c989ca48927e0a0c547dac50e2057527346fd 100644 (file)
@@ -32,8 +32,6 @@ public class Java21PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTe
   /**
    * Still not implemented with the Java 21 release Eclipse 2023-12 (4.30),
    * see <a href="https://github.com/eclipse-jdt/eclipse.jdt.core/issues/893">GitHub issue 893</a>.
-   * <p>
-   * TODO: Activate after JDT Core implementation and merge.
    */
   public void testUnnamedPatterns() {
     //runTest("unnamed patterns");
@@ -43,8 +41,6 @@ public class Java21PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTe
   /**
    * Still not implemented with the Java 21 release Eclipse 2023-12 (4.30),
    * see <a href="https://github.com/eclipse-jdt/eclipse.jdt.core/issues/893">GitHub issue 893</a>.
-   * <p>
-   * TODO: Activate after JDT Core implementation and merge.
    */
   public void testUnnamedPatternsAspect() {
     //runTest("unnamed patterns aspect");
@@ -73,8 +69,6 @@ public class Java21PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTe
   /**
    * Still not implemented with the Java 21 release Eclipse 2023-12 (4.30),
    * see <a href="https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1106">GitHub issue 1106</a>.
-   * <p>
-   * TODO: Activate after JDT Core implementation and merge.
    */
   public void testUnnamedClassWithSimpleMainMethod() {
     //runTest("unnamed class with simple main method");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1922/Ajc1922TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1922/Ajc1922TestsJava.java
new file mode 100644 (file)
index 0000000..5130a1c
--- /dev/null
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc1922;
+
+import junit.framework.Test;
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.systemtest.ajc10x.Ajc10xTests;
+import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class Ajc1922TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase {
+
+  private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(22);
+
+  public Ajc1922TestsJava() {
+    super(22);
+  }
+
+  public void testUnnamedPatterns() {
+    runTest("unnamed patterns");
+  }
+
+  public void testUnnamedPatternsAspect() {
+    runTest("unnamed patterns aspect");
+  }
+
+  /**
+   * Same as {@link Ajc10xTests#test052()}, but compiled to target 22 instead of 1.4
+   */
+  public void testUnderscoreInPointcutPattern1() {
+    runTest("underscore can still be used in pointcut patterns on Java 21+ - 1");
+  }
+
+  public void testUnderscoreInPointcutPattern2() {
+    runTest("underscore can still be used in pointcut patterns on Java 21+ - 2");
+  }
+
+  public static Test suite() {
+    return XMLBasedAjcTestCase.loadSuite(Ajc1922TestsJava.class);
+  }
+
+  @Override
+  protected java.net.URL getSpecFile() {
+    return getClassResource("ajc1922.xml");
+  }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1922/AllTestsAspectJ1922.java b/tests/src/test/java/org/aspectj/systemtest/ajc1922/AllTestsAspectJ1922.java
new file mode 100644 (file)
index 0000000..b32e9ed
--- /dev/null
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc1922;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.aspectj.tools.ant.taskdefs.AjcTask;
+import org.aspectj.util.LangUtil;
+
+// AspectJ_JDK_Update
+//  - Copy 'ajc*' package with all classes to a new package, incrementing the version number in the package
+//  - Rename all classes, incrementing version numbers
+//  - Add this class to the suite in class AllTests19
+//  - Increment version numbers in strings, method calls and constants to the appropriate values, creating necessary
+//    methods and constants classes providing them, if they do not exist yet
+//  - Also increment references to 'ajc*.xml' and 'sanity-tests-*.xml' test definition, copying the previous
+//    tests/src/test/resources/org/aspectj/systemtest/ajc* directory, incrementing all names and adjusting the XML
+//    file contents appropriately
+//  - Search for other 'AspectJ_JDK_Update' hints in the repository, also performing the necessary to-dos there
+//  - Remove this comment from the previous class version after copying this one
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class AllTestsAspectJ1922 {
+
+       private static final int JAVA_VERSION = 22;
+
+       public static Test suite() {
+               TestSuite suite = new TestSuite("AspectJ 1.9.22 tests");
+               suite.addTest(Bugs1922Tests.suite());
+               if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) {
+                       suite.addTest(SanityTestsJava22.suite());
+                       suite.addTest(Ajc1922TestsJava.suite());
+               }
+
+               // Do not run tests using a previous compiler's preview features anymore. They would all fail.
+               if (AjcTask.JAVA_VERSION_MAX == JAVA_VERSION) {
+                       if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION) && LangUtil.isVMLessOrEqual(JAVA_VERSION)) {
+                               suite.addTest(Java22PreviewFeaturesTests.suite());
+                       }
+               }
+               return suite;
+       }
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1922/Bugs1922Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1922/Bugs1922Tests.java
new file mode 100644 (file)
index 0000000..06211a1
--- /dev/null
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc1922;
+
+import junit.framework.Test;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class Bugs1922Tests extends XMLBasedAjcTestCase {
+
+  public void testDummy() {
+    //runTest("dummy");
+  }
+
+  public static Test suite() {
+    return XMLBasedAjcTestCase.loadSuite(Bugs1922Tests.class);
+  }
+
+  @Override
+  protected java.net.URL getSpecFile() {
+    return getClassResource("ajc1922.xml");
+  }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1922/Java22PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1922/Java22PreviewFeaturesTests.java
new file mode 100644 (file)
index 0000000..0116f88
--- /dev/null
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc1922;
+
+import junit.framework.Test;
+import org.aspectj.systemtest.ajc10x.Ajc10xTests;
+import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class Java22PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase {
+
+  public Java22PreviewFeaturesTests() {
+    super(22, 22);
+  }
+
+  public void testStringPatterns() {
+    runTest("string patterns");
+  }
+
+  public void testStringPatternsAspect() {
+    runTest("string patterns aspect");
+  }
+
+  public void testNamedClassWithSimpleMainMethod() {
+    runTest("named class with simple main method");
+  }
+
+  public void testNamedAspectWithSimpleMainMethod() {
+    runTest("named aspect with simple main method");
+  }
+
+  /**
+   * Still not implemented with the Java 21 release Eclipse 2023-12 (4.30),
+   * see <a href="https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1106">GitHub issue 1106</a>.
+   */
+  public void testUnnamedClassWithSimpleMainMethod() {
+    runTest("unnamed class with simple main method");
+  }
+
+  public static Test suite() {
+    return XMLBasedAjcTestCase.loadSuite(Java22PreviewFeaturesTests.class);
+  }
+
+  @Override
+  protected java.net.URL getSpecFile() {
+    return getClassResource("ajc1922.xml");
+  }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java b/tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java
new file mode 100644 (file)
index 0000000..30cea09
--- /dev/null
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc1922;
+
+import junit.framework.Test;
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/*
+ * Some very trivial tests that help verify things are OK.
+ * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -22 option
+ * to check code generation and modification with that version specified.
+ *
+ * @author Alexander Kriegisch
+ */
+public class SanityTestsJava22 extends JavaVersionSpecificXMLBasedAjcTestCase {
+
+       public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(22).MAJOR;
+
+       public SanityTestsJava22() {
+               super(22);
+       }
+
+       // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug)
+       public void testSimpleJava_A() {
+               runTest("simple - a");
+       }
+
+       public void testSimpleJava_B() {
+               runTest("simple - b");
+       }
+
+       public void testSimpleCode_C() {
+               runTest("simple - c");
+       }
+
+       public void testSimpleCode_D() {
+               runTest("simple - d");
+       }
+
+       public void testSimpleCode_E() {
+               runTest("simple - e");
+       }
+
+       public void testSimpleCode_F() {
+               runTest("simple - f");
+       }
+
+       public void testSimpleCode_G() {
+               runTest("simple - g");
+       }
+
+       public void testSimpleCode_H() {
+               runTest("simple - h", true);
+       }
+
+       public void testSimpleCode_I() {
+               runTest("simple - i");
+       }
+
+       public void testVersionCorrect1() {
+               runTest("simple - j");
+               checkVersion("A", bytecode_version_for_JDK_level, 0);
+       }
+
+       public void testVersionCorrect2() {
+               runTest("simple - k");
+               checkVersion("A", bytecode_version_for_JDK_level, 0);
+       }
+
+       public void testVersionCorrect4() {
+               runTest("simple - m");
+               // Must be 49.0 when -1.5 is specified
+               checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0);
+       }
+
+       public static Test suite() {
+               return XMLBasedAjcTestCase.loadSuite(SanityTestsJava22.class);
+       }
+
+       @Override
+       protected java.net.URL getSpecFile() {
+               return getClassResource("sanity-tests-22.xml");
+       }
+
+}
index 494b6daddc34bce457222ea5cca65fd15a5f53d7..7e948495a8f5ed38412760ba4ec9c912d832e4f3 100644 (file)
                <compile files="UnnamedPatternsPreview1.java" options="--enable-preview -21"/>
                <run class="UnnamedPatternsPreview1" vmargs="--enable-preview">
                        <stdout ordered="yes">
+                               <line text="2"/>
+                               <line text="side effect"/>
                                <line text="0"/>
                                <line text="1"/>
                                <line text="java.awt.Point[x=1,y=2]"/>
        <!-- Java 21 preview -->
        <!-- TODO: Activate after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/893 is done -->
        <ajc-test dir="features1921/java21" vm="21" title="unnamed patterns aspect">
-               <compile files="UnnamedPatternsPreview1Aspect.java" options="--enable-preview -21"/>
+               <compile files="UnnamedPatternsPreview1Aspect.aj" options="--enable-preview -21"/>
                <run class="UnnamedPatternsPreview1Aspect" vmargs="--enable-preview">
                        <stdout ordered="yes">
                                <line text="execution(void UnnamedPatternsPreview1Aspect.main(String[]))"/>
+                               <line text="2"/>
+                               <line text="side effect"/>
                                <line text="0"/>
                                <line text="1"/>
                                <line text="java.awt.Point[x=1,y=2]"/>
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1922/ajc1922.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1922/ajc1922.xml
new file mode 100644 (file)
index 0000000..56dd2c8
--- /dev/null
@@ -0,0 +1,202 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<!--
+       JDK 22 (https://openjdk.org/projects/jdk/22/):
+               Language features:
+                       JEP 456: Unnamed Variables & Patterns
+                       JEP 459: String Templates (Second Preview)
+                       JEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview)
+                       JEP 447: Statements before super(...) (Preview)
+               API or JVM only:
+                       JEP 423: Region Pinning for G1
+                       JEP 454: Foreign Function & Memory API
+                       JEP 458: Launch Multi-File Source-Code Programs
+                       JEP 462: Structured Concurrency (Second Preview)
+                       JEP 464: Scoped Values (Second Preview)
+                       JEP 457: Class-File API (Preview)
+                       JEP 461: Stream Gatherers (Preview)
+                       JEP 460: Vector API (Seventh Incubator)
+-->
+<suite>
+
+       <!-- Java 22 final, 21 preview -->
+       <!-- TODO: Activate after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/893 is done -->
+       <ajc-test dir="features1921/java21" vm="22" title="unnamed patterns">
+               <compile files="UnnamedPatternsPreview1.java" options="-22"/>
+               <run class="UnnamedPatternsPreview1">
+                       <stdout ordered="yes">
+                               <line text="2"/>
+                               <line text="side effect"/>
+                               <line text="0"/>
+                               <line text="1"/>
+                               <line text="java.awt.Point[x=1,y=2]"/>
+                               <line text="java.awt.Point[x=4,y=5]"/>
+                               <line text="java.awt.Point[x=1,y=0]"/>
+                               <line text="java.awt.Point[x=4,y=0]"/>
+                               <line text="Bad number: 123xy"/>
+                               <line text="Doing something within scoped context"/>
+                               <line text="Closing scoped context"/>
+                               <line text="{ONE=NODATA, TWO=NODATA, THREE=NODATA}"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+       <!-- Java 22 final, 21 preview -->
+       <!-- TODO: Activate after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/893 is done -->
+       <ajc-test dir="features1921/java21" vm="22" title="unnamed patterns aspect">
+               <compile files="UnnamedPatternsPreview1Aspect.aj" options="-22"/>
+               <run class="UnnamedPatternsPreview1Aspect">
+                       <stdout ordered="yes">
+                               <line text="execution(void UnnamedPatternsPreview1Aspect.main(String[]))"/>
+                               <line text="2"/>
+                               <line text="side effect"/>
+                               <line text="0"/>
+                               <line text="1"/>
+                               <line text="java.awt.Point[x=1,y=2]"/>
+                               <line text="java.awt.Point[x=4,y=5]"/>
+                               <line text="java.awt.Point[x=1,y=0]"/>
+                               <line text="java.awt.Point[x=4,y=0]"/>
+                               <line text="Bad number: 123xy"/>
+                               <line text="Doing something within scoped context"/>
+                               <line text="Closing scoped context"/>
+                               <line text="{ONE=NODATA, TWO=NODATA, THREE=NODATA}"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+       <!-- Java 22 final, 21 preview -->
+       <ajc-test dir="new" vm="22" title="underscore can still be used in pointcut patterns on Java 21+ - 1">
+               <compile files="NotCharInPointcut.java" options="-22">
+                       <message kind="warning" line="51" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
+                       <message kind="warning" line="52" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
+                       <message kind="warning" line="53" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
+               </compile>
+               <run class="NotCharInPointcut"/>
+       </ajc-test>
+
+       <!-- Java 22 final, 21 preview -->
+       <ajc-test dir="features1921/java21" vm="22" title="underscore can still be used in pointcut patterns on Java 21+ - 2">
+               <compile files="UnderscoreInPointcutAspect.aj" options="-22"/>
+               <run class="UnderscoreInPointcutAspect">
+                       <stdout>
+                               <line text="[starts with underscore] execution(int UnderTest._add(int, int)) -> 12, 4"/>
+                               <line text="[contains underscore] execution(int UnderTest._add(int, int)) -> 12, 4"/>
+                               <line text="16"/>
+                               <line text="[starts with underscore] execution(int UnderTest._subtract(int, int)) -> 12, 4"/>
+                               <line text="[contains underscore] execution(int UnderTest._subtract(int, int)) -> 12, 4"/>
+                               <line text="8"/>
+                               <line text="[ends with underscore] execution(int UnderTest.multiply_(int, int)) -> 12, 4"/>
+                               <line text="[contains underscore] execution(int UnderTest.multiply_(int, int)) -> 12, 4"/>
+                               <line text="48"/>
+                               <line text="[ends with underscore] execution(int UnderTest.divide_(int, int)) -> 12, 4"/>
+                               <line text="[contains underscore] execution(int UnderTest.divide_(int, int)) -> 12, 4"/>
+                               <line text="3"/>
+                               <line text="[contains underscore] execution(int UnderTest.power_of(int, int)) -> 3, 3"/>
+                               <line text="27"/>
+                               <line text="[no underscore] execution(int UnderTest.squareRoot(int)) -> 49"/>
+                               <line text="7"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+       <!-- Java 21, 22 preview -->
+       <ajc-test dir="features1921/java21" vm="22" title="string patterns">
+               <compile files="StringPatternsPreview1.java" options="--enable-preview -22"/>
+               <run class="StringPatternsPreview1" vmargs="--enable-preview">
+                       <stdout ordered="yes">
+                               <line text="Bill Duck"/>
+                               <line text="10 + 20 = 30"/>
+                               <line text="You have a special New Year's sale discount waiting for you!"/>
+                               <line text="Access at 2011-11-11 11:11:11 from localhost/127.0.0.1"/>
+                               <line text="The file _dummy.dat does not exist"/>
+                               <line text="The time is 11:11:11 or roughly eleven after eleven"/>
+                               <line text="apples, oranges, peaches"/>
+                               <line text=""/>
+                               <line text="&lt;html&gt;"/>
+                               <line text="  &lt;head&gt;"/>
+                               <line text="    &lt;title&gt;My Web Page&lt;/title&gt;"/>
+                               <line text="  &lt;/head&gt;"/>
+                               <line text="  &lt;body&gt;"/>
+                               <line text="    &lt;p&gt;Hello, world&lt;/p&gt;"/>
+                               <line text="  &lt;/body&gt;"/>
+                               <line text="&lt;/html&gt;"/>
+                               <line text=""/>
+                               <line text="Description     Width    Height     Area"/>
+                               <line text="Alfa            17.80    31.40      558.92"/>
+                               <line text="Bravo            9.60    12.40      119.04"/>
+                               <line text="Charlie          7.10    11.23       79.73"/>
+                               <line text="                             Total  757.69"/>
+                               <line text=""/>
+                               <line text="My name is Joan"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+       <!-- Java 21, 22 preview -->
+       <ajc-test dir="features1921/java21" vm="22" title="string patterns aspect">
+               <compile files="StringPatternsPreview1Aspect.aj" options="--enable-preview -22"/>
+               <run class="StringPatternsPreview1Aspect" vmargs="--enable-preview">
+                       <stdout ordered="yes">
+                               <line text="execution(void StringPatternsPreview1Aspect.main(String[]))"/>
+                               <line text="Bill Duck"/>
+                               <line text="10 + 20 = 30"/>
+                               <line text="You have a special New Year's sale discount waiting for you!"/>
+                               <line text="Access at 2011-11-11 11:11:11 from localhost/127.0.0.1"/>
+                               <line text="The file _dummy.dat does not exist"/>
+                               <line text="The time is 11:11:11 or roughly eleven after eleven"/>
+                               <line text="apples, oranges, peaches"/>
+                               <line text=""/>
+                               <line text="&lt;html&gt;"/>
+                               <line text="  &lt;head&gt;"/>
+                               <line text="    &lt;title&gt;My Web Page&lt;/title&gt;"/>
+                               <line text="  &lt;/head&gt;"/>
+                               <line text="  &lt;body&gt;"/>
+                               <line text="    &lt;p&gt;Hello, world&lt;/p&gt;"/>
+                               <line text="  &lt;/body&gt;"/>
+                               <line text="&lt;/html&gt;"/>
+                               <line text=""/>
+                               <line text="Description     Width    Height     Area"/>
+                               <line text="Alfa            17.80    31.40      558.92"/>
+                               <line text="Bravo            9.60    12.40      119.04"/>
+                               <line text="Charlie          7.10    11.23       79.73"/>
+                               <line text="                             Total  757.69"/>
+                               <line text=""/>
+                               <line text="My name is Joan"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+       <!-- Java 21, 22 preview -->
+       <ajc-test dir="features1921/java21" vm="22" title="named class with simple main method">
+               <!-- Compiles without preview mode, but needs preview mode to run -->
+               <compile files="NamedClassWithSimpleMainMethodPreview1.java" options="-22 --enable-preview"/>
+               <run class="NamedClassWithSimpleMainMethodPreview1" vmargs="--enable-preview">
+                       <stdout>
+                               <line text="Hello world!"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+       <!-- Java 21, 22 preview -->
+       <ajc-test dir="features1921/java21" vm="22" title="named aspect with simple main method">
+               <!-- Compiles without preview mode, but needs preview mode to run -->
+               <compile files="NamedAspectWithSimpleMainMethodPreview1.aj" options="-22 --enable-preview"/>
+               <run class="NamedAspectWithSimpleMainMethodPreview1" vmargs="--enable-preview">
+                       <stdout>
+                               <line text="Hello world!"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+       <!-- Java 21, 22 preview -->
+       <!-- TODO: Activate after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1106 is done -->
+       <ajc-test dir="features1921/java21" vm="22" title="unnamed class with simple main method">
+               <compile files="UnnamedClassWithSimpleMainMethodPreview1.java" options="-22 --enable-preview"/>
+               <run class="UnnamedClassWithSimpleMainMethodPreview1" vmargs="--enable-preview">
+                       <stdout>
+                               <line text="Hello world!"/>
+                       </stdout>
+               </run>
+       </ajc-test>
+
+</suite>
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1922/sanity-tests-22.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1922/sanity-tests-22.xml
new file mode 100644 (file)
index 0000000..fceaf46
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+    <!-- empty class -->
+    <ajc-test dir="bugs160/simplejava" title="simple - a">
+      <compile files="SimpleA.java" options="-22"/>
+    </ajc-test>
+
+    <!-- class with one method -->
+    <ajc-test dir="bugs160/simplejava" title="simple - b">
+      <compile files="SimpleB.java" options="-22"/>
+      <run class="SimpleB"/>
+    </ajc-test>
+
+    <!-- empty aspect -->
+    <ajc-test dir="bugs160/simplejava" title="simple - c">
+      <compile files="SimpleC.java" options="-22"/>
+    </ajc-test>
+
+    <!-- simple before -->
+    <ajc-test dir="bugs160/simplejava" title="simple - d">
+      <compile files="SimpleD.java" options="-22"/>
+    </ajc-test>
+
+    <!-- simple itd field -->
+    <ajc-test dir="bugs160/simplejava" title="simple - e">
+      <compile files="SimpleE.java" options="-22"/>
+    </ajc-test>
+
+    <!-- aspect with main calling a static method -->
+    <ajc-test dir="bugs160/simplejava" title="simple - f">
+      <compile files="SimpleF.java" options="-22"/>
+    </ajc-test>
+
+    <!-- pertarget -->
+    <ajc-test dir="bugs160/simplejava" title="simple - g">
+      <compile files="SimpleG.java" options="-22"/>
+    </ajc-test>
+
+    <!-- generic ctor itds -->
+    <ajc-test dir="bugs160/simplejava" title="simple - h">
+      <compile files="SimpleH.java" options="-22"/>
+    </ajc-test>
+
+    <!-- overriding generic itd methods -->
+    <ajc-test dir="bugs160/simplejava" title="simple - i">
+      <compile files="SimpleI.java" options="-22"/>
+    </ajc-test>
+
+    <!-- check class file version is 66.0 (Java 22) -->
+    <ajc-test dir="bugs160/simplejava" title="simple - j">
+      <compile files="SimpleJ.java" options="-22"/>
+    </ajc-test>
+
+    <!-- check class file version is 66.0 (Java 22) -->
+    <ajc-test dir="bugs160/simplejava" title="simple - k">
+      <compile files="SimpleJ.java" options="-source 22"/>
+    </ajc-test>
+
+    <!-- check class file version is 49.0 -->
+    <ajc-test dir="bugs160/simplejava" title="simple - m">
+      <compile files="SimpleJ.java" options="-1.5"/>
+    </ajc-test>
+
+    <ajc-test dir="bugs160/simplejava" title="simple - n">
+      <compile files="SimpleN.java" options="-22"/>
+    </ajc-test>
+
+</suite>