diff options
Diffstat (limited to 'tests/src/test/java')
9 files changed, 271 insertions, 16 deletions
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/ajc1923/Ajc1923TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Ajc1923TestsJava.java index 08e32db82..083f8a3b4 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Ajc1923TestsJava.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Ajc1923TestsJava.java @@ -32,9 +32,9 @@ public class Ajc1923TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { protected java.net.URL getSpecFile() { return getClassResource("ajc1923.xml"); } - - public void testJep455PrimitivePatternsSwitch2() { - runTest("primitive types patterns - switch - with advice"); + + public void testNothing() { } + } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1923/AllTestsAspectJ1923.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/AllTestsAspectJ1923.java index 7ed05849e..7498d6995 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1923/AllTestsAspectJ1923.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/AllTestsAspectJ1923.java @@ -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 * @author Andy Clement diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java index 8a3547472..2b26d8d6e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java @@ -42,6 +42,10 @@ public class Bugs1923Tests extends XMLBasedAjcTestCase { public void testGh326_ClassCastExceptionHandling() { runTest("classcast on exception handling aspect"); } + + public void testGh322_DeprecatedAnnotation() { + runTest("ajc error for particular Pointcut and @Deprecated"); + } @Override protected java.net.URL getSpecFile() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1924/Ajc1924TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Ajc1924TestsJava.java new file mode 100644 index 000000000..dfdb1ccdf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Ajc1924TestsJava.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2025 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.ajc1924; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc1924TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { + + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(24); + + public Ajc1924TestsJava() { + super(24); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1924TestsJava.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1924.xml"); + } + + public void testJep455PrimitivePatternsSwitch2() { + runTest("primitive types patterns - switch - with advice"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1924/AllTestsAspectJ1924.java b/tests/src/test/java/org/aspectj/systemtest/ajc1924/AllTestsAspectJ1924.java new file mode 100644 index 000000000..d644c842d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1924/AllTestsAspectJ1924.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2025 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.ajc1924; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.ajc1923.Ajc1923TestsJava; +import org.aspectj.systemtest.ajc1923.Bugs1923Tests; +import org.aspectj.systemtest.ajc1923.Java23PreviewFeaturesTests; +import org.aspectj.systemtest.ajc1923.SanityTestsJava23; +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 Andy Clement + */ +public class AllTestsAspectJ1924 { + + private static final int JAVA_VERSION = 24; + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.24 tests"); + suite.addTest(Bugs1924Tests.suite()); + if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { + suite.addTest(SanityTestsJava24.suite()); + suite.addTest(Ajc1924TestsJava.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(Java24PreviewFeaturesTests.suite()); + } + } + 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 new file mode 100644 index 000000000..aeb283c02 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Bugs1924Tests.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2025 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.ajc1924; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Bugs1924Tests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Bugs1924Tests.class); + } + + 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() { + return getClassResource("ajc1924.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java new file mode 100644 index 000000000..1143e604c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1924/Java24PreviewFeaturesTests.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2025 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.ajc1924; + +import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Java24PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { + + public Java24PreviewFeaturesTests() { + super(24, 24); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Java24PreviewFeaturesTests.class); + } + + public void testNothing() { + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1924.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1924/SanityTestsJava24.java b/tests/src/test/java/org/aspectj/systemtest/ajc1924/SanityTestsJava24.java new file mode 100644 index 000000000..c423c8cea --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1924/SanityTestsJava24.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2025 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.ajc1924; + +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 -23 option + * to check code generation and modification with that version specified. + * + * @author Andy Clement + */ +public class SanityTestsJava24 extends JavaVersionSpecificXMLBasedAjcTestCase { + + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(24).MAJOR; + + public SanityTestsJava24() { + super(24); + } + + // 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"); + checkVersion("A", Constants.ClassFileVersion.of(8).MAJOR, 0); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava24.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-24.xml"); + } + +} |