From: Alexander Kriegisch Date: Thu, 5 Oct 2023 01:09:24 +0000 (+0700) Subject: Add test infrastructure for Java 21 (WIP) X-Git-Tag: V1_9_21_M1~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=78ee9cebd81f1496d69bd0c933e3ee16fa02a96f;p=aspectj.git Add test infrastructure for Java 21 (WIP) The tests and their XML definitions are still copy & paste and need to be cleaned up. Separate Java 21 feature tests do not exist yet. Signed-off-by: Alexander Kriegisch --- diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java index 216bdfdde..77477747c 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java @@ -104,8 +104,10 @@ public interface Constants { short MINOR_19 = 0; short MAJOR_20 = 64; short MINOR_20 = 0; -// short MAJOR_21 = 65; -// short MINOR_21 = 0; + short MAJOR_21 = 65; + short MINOR_21 = 0; +// short MAJOR_22 = 66; +// short MINOR_22 = 0; int PREVIEW_MINOR_VERSION = 65535; diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java index 23905d45d..ab99fd670 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java @@ -252,15 +252,15 @@ public class AjcTask extends MatchingTask { static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", - "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" + "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21" }; static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", - "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" + "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21" }; static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", - "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18", "-19", "-20" + "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18", "-19", "-20", "-21" }; private static final ICommandEditor COMMAND_EDITOR; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java index aeb1152fd..4e0567d0d 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java @@ -20,14 +20,13 @@ public abstract class XMLBasedAjcTestCaseForJava20Only extends XMLBasedAjcTestCa @Override public void setUp() throws Exception { // Activate this block after upgrading to JDT Core Java 21 - /* throw new IllegalStateException( "These tests need a Java 20 level AspectJ compiler " + "(e.g. because they use version-specific preview features). " + "This compiler does not support preview features of a previous version anymore." ); - */ // Activate this block before upgrading to JDT Core Java 21 + /* if (!LangUtil.is20VMOrGreater() || LangUtil.is21VMOrGreater()) { throw new IllegalStateException( "These tests should be run on Java 20 only " + @@ -35,6 +34,7 @@ public abstract class XMLBasedAjcTestCaseForJava20Only extends XMLBasedAjcTestCa ); } super.setUp(); + */ } } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java new file mode 100644 index 000000000..fb6795b3d --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java @@ -0,0 +1,40 @@ +/* ******************************************************************* + * Copyright (c) 2023 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.testing; + +import org.aspectj.util.LangUtil; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Alexander Kriegisch + */ +public abstract class XMLBasedAjcTestCaseForJava21Only extends XMLBasedAjcTestCase { + + @Override + public void setUp() throws Exception { + // Activate this block after upgrading to JDT Core Java 22 + /* + throw new IllegalStateException( + "These tests need a Java 21 level AspectJ compiler " + + "(e.g. because they use version-specific preview features). " + + "This compiler does not support preview features of a previous version anymore." + ); + */ + // Activate this block before upgrading to JDT Core Java 22 + if (!LangUtil.is21VMOrGreater() || LangUtil.is22VMOrGreater()) { + throw new IllegalStateException( + "These tests should be run on Java 21 only " + + "(e.g. because they use version-specific preview features)" + ); + } + super.setUp(); + } + +} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java new file mode 100644 index 000000000..4c1d59d15 --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java @@ -0,0 +1,27 @@ +/* ******************************************************************* + * Copyright (c) 2023 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.testing; + +import org.aspectj.util.LangUtil; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Alexander Kriegisch + */ +public abstract class XMLBasedAjcTestCaseForJava21OrLater extends XMLBasedAjcTestCase { + + @Override + public void setUp() throws Exception { + if (!LangUtil.is21VMOrGreater()) + throw new IllegalStateException("These tests should be run on Java 21 or later"); + super.setUp(); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java index c7962c2db..a095eb758 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java @@ -24,10 +24,11 @@ public class AllTestsAspectJ1920 { suite.addTest(Ajc1920TestsJava.suite()); } // Do not run tests using a previous compiler's preview features anymore. They would all fail. - // TODO: Comment out the following block when upgrading JDT Core to Java 20 + /* if (LangUtil.is20VMOrGreater() && !LangUtil.is21VMOrGreater()) { suite.addTest(Java20PreviewFeaturesTests.suite()); } + */ return suite; } } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java index e597b32ec..89a0a61c6 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Java20PreviewFeaturesTests.java @@ -52,7 +52,7 @@ public class Java20PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava20Only } public void testRecordPatternsPreview1Error() { - // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 (fixed for preview 2 in Eclipse 2033-03, 4.27) + // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 (fixed for preview 2 in Eclipse 2023-03, 4.27) runTest("record patterns error"); checkVersion("RecordPatternsPreview1Error", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); checkVersion("Box", Constants.MAJOR_20, Constants.PREVIEW_MINOR_VERSION); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java new file mode 100644 index 000000000..e7d3b9596 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2022 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.ajc1921; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater; + +/** + * @author Alexander Kriegisch + */ +public class Ajc1921TestsJava extends XMLBasedAjcTestCaseForJava21OrLater { + + public void testDummyJava21() { + //runTest("dummy Java 21"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1921TestsJava.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1921.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java new file mode 100644 index 000000000..773ac9037 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2022 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.ajc1921; + +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.util.LangUtil; + +/** + * @author Alexander Kriegisch + */ +public class AllTestsAspectJ1921 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.21 tests"); + suite.addTest(Bugs1921Tests.suite()); + if (LangUtil.is21VMOrGreater()) { + suite.addTest(SanityTestsJava21.suite()); + suite.addTest(Ajc1921TestsJava.suite()); + } + // Do not run tests using a previous compiler's preview features anymore. They would all fail. + // TODO: Comment out the following block when upgrading JDT Core to Java 22 + if (LangUtil.is21VMOrGreater() && !LangUtil.is22VMOrGreater()) { + suite.addTest(Java21PreviewFeaturesTests.suite()); + } + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java new file mode 100644 index 000000000..3c11149d3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java @@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2023 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.ajc1921; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Alexander Kriegisch + */ +public class Bugs1921Tests extends XMLBasedAjcTestCase { + + public void testSwitchWith_Integer_MAX_VALUE() { + runTest("switch with Integer.MAX_VALUE case"); + } + + public void testParenthesisedExpressionWithAjKeyword() { + runTest("parenthesised expression with AspectJ keyword"); + } + + public void testInterfaceInnerAspectImplicitlyStatic() { + runTest("inner aspect of interface is implicitly static"); + } + + public void testExactArrayTypeMatchCompiledTogether() { + runTest("exact array type matching, aspect compiled together with target class"); + } + + public void testExactArrayTypeMatchCompiledSeparately() { + runTest("exact array type matching, aspect compiled separately from target class"); + } + + public void testFuzzyArrayTypeMatchCompiledTogether() { + runTest("fuzzy array type matching, aspect compiled together with target class"); + } + + public void testFuzzyArrayTypeMatchCompiledSeparately() { + runTest("fuzzy array type matching, aspect compiled separately from target class"); + } + + public void test_GitHub_214() { + runTest("ArrayIndexOutOfBoundsException with Xlint unorderedAdviceAtShadow=warning"); + } + + /** + * Add correct annotations to multiple ITD methods with the same name and same number of arguments, i.e. copy the + * annotations correctly from the aspect into the target class instead of falsely always copying the annotations (if + * any) from the first ITD method found. + *

+ * See GitHub issue 246. + */ + public void test_GitHub_246() { + runTest("add correct annotations to multiple ITD methods with the same name and same number of arguments"); + } + + /** + * Make sure to create one {@code ajc$inlineAccessMethod} for identically named (overloaded) private aspect methods. + *

+ * See GitHub issue 250. + */ + public void test_GitHub_250() { + runTest("correctly handle overloaded private methods in aspects"); + } + + /** + * If one generic method overrides another one with a narrower return type, avoid matching bridge methods. + *

+ * See Spring GitHub issue 27761. + *

+ * This test uses an ASM-modified class file reproducing the problem seen in Spring in plain AspectJ. Before the + * bugfix, it fails with "advice defined in RepositoryAspect has not been applied [Xlint:adviceDidNotMatch]". + */ + public void test_Spring_GitHub_27761() { + runTest("do not match bridge methods"); + } + + /** + * In 1.9.20, a regression bug occurred, matching negated types like '!void' and '!String' incorrectly. + *

+ * See GitHub issue 257. + */ + public void test_GitHub_257() { + runTest("handle negated type patterns correctly"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Bugs1921Tests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1921.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java new file mode 100644 index 000000000..1088aac63 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2023 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.ajc1921; + +import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava21Only; + +/** + * @author Alexander Kriegisch + */ +public class Java21PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava21Only { + + public void testSwitchPatternMatchingPreview4Java() { + runTest("switch pattern matching preview 4 java"); + checkVersion("SwitchPatternPreview4OK", Constants.MAJOR_21, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitchPatternMatchingPreview4Error() { + runTest("switch pattern matching preview 4 error"); + } + + public void testSwitchPatternMatchingPreview3Aspect() { + runTest("switch pattern matching preview 3 aspect"); + checkVersion("SwitchPatternPreview3Aspect", Constants.MAJOR_21, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Application", Constants.MAJOR_21, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Shape", Constants.MAJOR_21, Constants.PREVIEW_MINOR_VERSION); + checkVersion("S", Constants.MAJOR_21, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { + runTest("switch pattern matching error"); + } + + public void testSwitchPatternMatchingPreview3Error1() { + runTest("switch pattern matching preview 3 error 1"); + } + + public void testSwitchPatternMatchingPreview3Error2() { + runTest("switch pattern matching preview 3 error 2"); + } + + public void testRecordPatternsPreview1OK() { + // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 + runTest("record patterns"); + } + + public void testRecordPatternsPreview1Error() { + // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 (fixed for preview 2 in Eclipse 2023-03, 4.27) + runTest("record patterns error"); + checkVersion("RecordPatternsPreview1Error", Constants.MAJOR_21, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Box", Constants.MAJOR_21, Constants.PREVIEW_MINOR_VERSION); + } + + public void testRecordPatternsPreview1ExhaustivenessOK1() { + // Falsely throws 'An enhanced switch statement should be exhaustive; a default label expected' twice, + // see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + // TODO: Remove redundant default clauses when fixed upstream + System.out.println("TODO: fully activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed"); + runTest("record patterns exhaustiveness 1"); + } + + public void testRecordPatternsPreview1Aspect() { + runTest("record patterns aspect"); + } + + public void testRecordPatternsPreview1ExhaustivenessAspect() { + // Falsely throws 'An enhanced switch statement should be exhaustive; a default label expected' twice, + // see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + // TODO: Remove redundant default clauses when fixed upstream + System.out.println("TODO: fully activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed"); + runTest("record patterns exhaustiveness aspect"); + } + + public void testRecordPatternsPreview1ExhaustivenessError() { + // See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 + runTest("record patterns exhaustiveness error"); + } + + public void testRecordPatternsPreview1ExhaustivenessOK2() { + // Falsely throws 'An enhanced switch statement should be exhaustive; a default label expected', + // see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/398 + // TODO: activate when fixed + System.out.println("TODO: activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/398 has been fixed"); + //runTest("record patterns exhaustiveness 2"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Java21PreviewFeaturesTests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1921.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java new file mode 100644 index 000000000..ed2216fdb --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/SanityTestsJava21.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2023 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.ajc1921; + +import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater; + +/* + * 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 -21 option + * to check code generation and modification with that version specified. + * + * @author Alexander Kriegisch + */ +public class SanityTestsJava21 extends XMLBasedAjcTestCaseForJava21OrLater { + + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_21; + + // 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.MAJOR_1_5, 0); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava21.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-21.xml"); + } + +} diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml index 86fa7db02..1d25a176a 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml @@ -105,7 +105,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1921/sanity-tests-21.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1921/sanity-tests-21.xml new file mode 100644 index 000000000..e7da49fa1 --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1921/sanity-tests-21.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java index 97676ea84..43d100165 100644 --- a/util/src/main/java/org/aspectj/util/LangUtil.java +++ b/util/src/main/java/org/aspectj/util/LangUtil.java @@ -191,6 +191,10 @@ public class LangUtil { return 21 <= vmVersion; } + public static boolean is22VMOrGreater() { + return 22 <= vmVersion; + } + /** * Shorthand for "if null, throw IllegalArgumentException" *