diff options
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc1923')
5 files changed, 263 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Ajc1923TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Ajc1923TestsJava.java new file mode 100644 index 000000000..083f8a3b4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Ajc1923TestsJava.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.ajc1923; + +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 Ajc1923TestsJava extends JavaVersionSpecificXMLBasedAjcTestCase { + + private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(23); + + public Ajc1923TestsJava() { + super(23); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1923TestsJava.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1923.xml"); + } + + 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 new file mode 100644 index 000000000..7498d6995 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/AllTestsAspectJ1923.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.ajc1923; + +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.tools.ant.taskdefs.AjcTask; +import org.aspectj.util.LangUtil; + +/** + * @author Alexander Kriegisch + * @author Andy Clement + */ +public class AllTestsAspectJ1923 { + + private static final int JAVA_VERSION = 23; + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.23 tests"); + suite.addTest(Bugs1923Tests.suite()); + if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) { + suite.addTest(SanityTestsJava23.suite()); + suite.addTest(Ajc1923TestsJava.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(Java23PreviewFeaturesTests.suite()); + } + } + return suite; + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java new file mode 100644 index 000000000..2b26d8d6e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * 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.ajc1923; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Bugs1923Tests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Bugs1923Tests.class); + } + + public void testGh328_AroundAdviceInlineAccessor() { + runTest("problem with inline accessor generator for around advice"); + } + + public void testGh327_IntertypeFields_Static() { + runTest("problem with intertype field declaration code generation - static"); + } + + public void testGh327_IntertypeFields_NonStatic() { + runTest("problem with intertype field declaration code generation - nonstatic"); + } + + public void testGh327_IntertypeFields_Private() { + runTest("problem with intertype field declaration code generation - private"); + } + + public void testGh327_IntertypeMethods() { + runTest("problem with intertype method declaration code generation"); + } + + 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() { + return getClassResource("ajc1923.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Java23PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Java23PreviewFeaturesTests.java new file mode 100644 index 000000000..270dff5f3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Java23PreviewFeaturesTests.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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.ajc1923; + +import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Java23PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase { + + public Java23PreviewFeaturesTests() { + super(23, 23); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Java23PreviewFeaturesTests.class); + } + + public void testJep455PrimitivePatternsSwitch1() { + runTest("primitive types patterns - switch"); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc1923.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1923/SanityTestsJava23.java b/tests/src/test/java/org/aspectj/systemtest/ajc1923/SanityTestsJava23.java new file mode 100644 index 000000000..11c318e3e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/SanityTestsJava23.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.ajc1923; + +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 SanityTestsJava23 extends JavaVersionSpecificXMLBasedAjcTestCase { + + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(23).MAJOR; + + public SanityTestsJava23() { + super(23); + } + + // 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(SanityTestsJava23.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-23.xml"); + } + +} |