diff options
Diffstat (limited to 'tests')
34 files changed, 663 insertions, 36 deletions
diff --git a/tests/bugs1923/gh322/SomeAnnotation.java b/tests/bugs1923/gh322/SomeAnnotation.java new file mode 100644 index 000000000..3d472d3f9 --- /dev/null +++ b/tests/bugs1923/gh322/SomeAnnotation.java @@ -0,0 +1,5 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface SomeAnnotation {} + diff --git a/tests/bugs1923/gh322/TheAspect.java b/tests/bugs1923/gh322/TheAspect.java new file mode 100644 index 000000000..41b33119a --- /dev/null +++ b/tests/bugs1923/gh322/TheAspect.java @@ -0,0 +1,11 @@ +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +public class TheAspect { + @Around("execution(* *(@SomeAnnotation (*), ..))") + public Object aroundContext(ProceedingJoinPoint pjp) throws Throwable { + return pjp.proceed(); + } +} diff --git a/tests/bugs1923/gh322/TheClass.java b/tests/bugs1923/gh322/TheClass.java new file mode 100644 index 000000000..590c4f7bf --- /dev/null +++ b/tests/bugs1923/gh322/TheClass.java @@ -0,0 +1,5 @@ +public class TheClass implements TheInterface { + @Override + public void method(int param) { + } +} diff --git a/tests/bugs1923/gh322/TheInterface.java b/tests/bugs1923/gh322/TheInterface.java new file mode 100644 index 000000000..358f9037b --- /dev/null +++ b/tests/bugs1923/gh322/TheInterface.java @@ -0,0 +1,3 @@ +public interface TheInterface { + void method(@Deprecated int param); +} diff --git a/tests/bugs1923/gh326/pkg/BusinessDao.java b/tests/bugs1923/gh326/pkg/BusinessDao.java new file mode 100644 index 000000000..8ab256912 --- /dev/null +++ b/tests/bugs1923/gh326/pkg/BusinessDao.java @@ -0,0 +1,9 @@ +package pkg; + +public class BusinessDao<D> { + + public D doSomething() throws SourceException { + return (D) new BusinessDto(); + } + +} diff --git a/tests/bugs1923/gh326/pkg/BusinessDto.java b/tests/bugs1923/gh326/pkg/BusinessDto.java new file mode 100644 index 000000000..42d792b27 --- /dev/null +++ b/tests/bugs1923/gh326/pkg/BusinessDto.java @@ -0,0 +1,8 @@ +package pkg; + +public class BusinessDto { + + public BusinessDto() throws SourceException { +throw new SourceException(); +} +} diff --git a/tests/bugs1923/gh326/pkg/BusinessService.java b/tests/bugs1923/gh326/pkg/BusinessService.java new file mode 100644 index 000000000..10d98400f --- /dev/null +++ b/tests/bugs1923/gh326/pkg/BusinessService.java @@ -0,0 +1,18 @@ +package pkg; + +public class BusinessService { + + @HandleSourceException(message="42") + public BusinessDto doSomething() throws TargetException { + return new BusinessDao<BusinessDto>().doSomething(); + } + + +public static void main(String []argv) throws TargetException { +try { + new BusinessService().doSomething(); +} catch (TargetException te) { + System.out.println(te.getMessage()); +} +} +} diff --git a/tests/bugs1923/gh326/pkg/HandleSourceException.java b/tests/bugs1923/gh326/pkg/HandleSourceException.java new file mode 100644 index 000000000..a5645cfac --- /dev/null +++ b/tests/bugs1923/gh326/pkg/HandleSourceException.java @@ -0,0 +1,17 @@ +package pkg; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Retention(RUNTIME) +@Target(METHOD) +public @interface HandleSourceException { + + String message() default ""; + + boolean useLogger() default true; + +} diff --git a/tests/bugs1923/gh326/pkg/SourceException.java b/tests/bugs1923/gh326/pkg/SourceException.java new file mode 100644 index 000000000..2ada2d6fe --- /dev/null +++ b/tests/bugs1923/gh326/pkg/SourceException.java @@ -0,0 +1,7 @@ +package pkg; + +public class SourceException extends Exception { + + private static final long serialVersionUID = 2789789285541660969L; + +} diff --git a/tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj b/tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj new file mode 100644 index 000000000..6bd48f3b7 --- /dev/null +++ b/tests/bugs1923/gh326/pkg/SourceExceptionHandlerAspect.aj @@ -0,0 +1,29 @@ +package pkg; + +import java.lang.annotation.Annotation; + +import org.aspectj.lang.reflect.MethodSignature; + +public aspect SourceExceptionHandlerAspect { + + pointcut handleSourceExceptionPointcut(): @annotation(HandleSourceException); + + declare soft : SourceException : handleSourceExceptionPointcut(); + + Object around() throws TargetException: handleSourceExceptionPointcut() { + try { + return proceed(); + } catch (Throwable exception) { + String message = ""; + Annotation[] annotations = ((MethodSignature) thisJoinPoint.getSignature()).getMethod().getAnnotationsByType(HandleSourceException.class); + if (annotations.length == 1) { + message = ((HandleSourceException) annotations[0]).message(); + } + if (message.isBlank()) { + message = exception.getMessage(); + } + throw new TargetException(message, exception); + } + } + +} diff --git a/tests/bugs1923/gh326/pkg/TargetException.java b/tests/bugs1923/gh326/pkg/TargetException.java new file mode 100644 index 000000000..aa3f5c868 --- /dev/null +++ b/tests/bugs1923/gh326/pkg/TargetException.java @@ -0,0 +1,11 @@ +package pkg; + +public class TargetException extends Exception { + + private static final long serialVersionUID = -1282142579066274623L; + + public TargetException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/tests/bugs1923/gh327/A.aj b/tests/bugs1923/gh327/A.aj index 28a38429f..f829f0ae0 100644 --- a/tests/bugs1923/gh327/A.aj +++ b/tests/bugs1923/gh327/A.aj @@ -1,5 +1,5 @@ privileged public aspect A { - public static final String B.s = C.f.toString(); + public final static String B.s = C.f.toString(); } class B { } diff --git a/tests/bugs1923/gh327/B.aj b/tests/bugs1923/gh327/B.aj new file mode 100644 index 000000000..c7aaddcd1 --- /dev/null +++ b/tests/bugs1923/gh327/B.aj @@ -0,0 +1,10 @@ +privileged public aspect B { + public final String C.s = D.f.toString(); +} + +class C { } + +class D { + public static final D f = new D(); +} + diff --git a/tests/bugs1923/gh327/C.aj b/tests/bugs1923/gh327/C.aj new file mode 100644 index 000000000..16e6bb543 --- /dev/null +++ b/tests/bugs1923/gh327/C.aj @@ -0,0 +1,10 @@ +privileged public aspect C { + private final String D.s = E.f.toString(); +} + +class D { } + +class E { + public static final E f = new E(); +} + diff --git a/tests/bugs1923/gh327/F.aj b/tests/bugs1923/gh327/F.aj new file mode 100644 index 000000000..45d6de0a8 --- /dev/null +++ b/tests/bugs1923/gh327/F.aj @@ -0,0 +1,13 @@ +class A {} + +class B {} + +public abstract aspect F { + @Deprecated + public abstract void C.displaySearch(StringBuffer buffer, String name, String prefix, A criteria, + B context); +} + +interface C { +} + 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/pom.xml b/tests/pom.xml index e00c06929..f800b1ae3 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.24-SNAPSHOT</version> + <version>1.9.25-SNAPSHOT</version> </parent> <artifactId>tests</artifactId> 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 1053c9918..2b26d8d6e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1923/Bugs1923Tests.java @@ -23,6 +23,30 @@ public class Bugs1923Tests extends XMLBasedAjcTestCase { 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/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"); + } + +} diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml index 238b0329f..41f4b8808 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml @@ -257,10 +257,18 @@ <!--<run class="ataspectj.DeclareParentsInterfaceTest" ltw="ataspectj/aop-decptest.xml"/>--> <ant file="ajc-ant.xml" target="ltw.Decp" verbose="true"> <stderr> + <line text="WARNING: A terminally deprecated method in sun.misc.Unsafe has been called" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: Please consider reporting this to the maintainers of class org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release" vm="24"/> <line text="Extending interface set for type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java) to include 'ataspectj.DeclareParentsInterfaceTest$Marker' (DeclareParentsInterfaceTest.java)"/> <line text="see also:"/> <line text="Join point 'method-execution(void ataspectj.DeclareParentsInterfaceTest$Target.target())' in Type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java:27) advised by before advice from 'ataspectj.DeclareParentsInterfaceTest$TestAspect' (DeclareParentsInterfaceTest.java)"/> <line text="see also:"/> + <line text="WARNING: A terminally deprecated method in sun.misc.Unsafe has been called" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: Please consider reporting this to the maintainers of class org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release" vm="24"/> <line text="Extending interface set for type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) to include 'ataspectj.DeclareParentsImplementsTest$Introduced' (DeclareParentsImplementsTest.java)"/> <line text="see also:"/> <line text="Type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) has intertyped method from 'ataspectj.DeclareParentsImplementsTest$TestAspect' (DeclareParentsImplementsTest.java:'void ataspectj.DeclareParentsImplementsTest$Introduced.intro()')"/> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml index fccc5c606..edfd2449e 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml @@ -513,6 +513,10 @@ </stdout> <stderr> <line text="TraceFactory.instance=" /> + <line text="WARNING: A terminally deprecated method in sun.misc.Unsafe has been called" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: Please consider reporting this to the maintainers of class org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release" vm="24"/> </stderr> </ant> </ajc-test> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc161/ajc161.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc161/ajc161.xml index 83d812a28..3dfac1c5f 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc161/ajc161.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc161/ajc161.xml @@ -70,7 +70,7 @@ <!-- this message no longer coming out with Java23 upgrade to ECJ --> <!-- message file="C.java" kind="error" line="1" text="Unnamed Classes and Instance Main Methods"/--> <!-- this message now comes out with Java23 upgrade to ECJ --> - <message file="C.java" kind="error" line="1" text="The preview feature Implicitly Declared Classes and Instance Main Methods is only available with source level 23 and above"/> + <message file="C.java" kind="error" line="1" text="The preview feature Implicitly Declared Classes and Instance Main Methods is only available with source level 24 and above"/> <message file="C.java" kind="error" line="2" text="blahblahpackage cannot be resolved to a type"/> <message file="C.java" kind="error" line="2" text="Implicitly declared class must have a candidate main method"/> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml index f21f16701..19a27feb8 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1923/ajc1923.xml @@ -30,31 +30,55 @@ </run> </ajc-test> - <!-- https://openjdk.org/jeps/455 --> - <ajc-test dir="features1923/java23" vm="23" title="primitive types patterns - switch - with advice"> - <compile files="PrimitivePatternsSwitch2.java" options="--enable-preview -23 -showWeaveInfo"> - <message kind="weave" line="12" text="Join point 'method-call(boolean PrimitivePatternsSwitch2.isOdd(int))' in Type 'PrimitivePatternsSwitch2' (PrimitivePatternsSwitch2.java:12) advised by around advice from 'X'"/>> - </compile> - <run class="PrimitivePatternsSwitch2" vmargs="--enable-preview"> - <stdout> - <!-- advice forces all the isOdd() calls to return false --> - <line text="no"/> - <line text="no"/> - <line text="no"/> - <line text="no"/> - </stdout> - </run> - </ajc-test> - <ajc-test dir="bugs1923/gh328" vm="17" title="problem with inline accessor generator for around advice"> <compile files="One.java" options="-17"> </compile> </ajc-test> - <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype field declaration code generation"> + <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype field declaration code generation - static"> <compile files="A.aj" options="-17"> </compile> </ajc-test> + <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype field declaration code generation - nonstatic"> + <compile files="B.aj" options="-17"> + </compile> + </ajc-test> + + <ajc-test dir="new/verifyError" pr="36673" + title="problem with intertype field declaration code generation - private"> + <compile files="Privilege.java" options="-17"/> + <run class="Privilege"/> + </ajc-test> + + <ajc-test dir="bugs1923/gh327" vm="17" title="problem with intertype method declaration code generation"> + <compile files="F.aj" options="-17"> + </compile> + </ajc-test> + + <ajc-test dir="bugs1923/gh326" vm="17" title="classcast on exception handling aspect"> + <compile files="pkg/BusinessDao.java pkg/BusinessService.java pkg/SourceException.java pkg/TargetException.java pkg/BusinessDto.java pkg/HandleSourceException.java pkg/SourceExceptionHandlerAspect.aj" options="-17"> + </compile> + <run class="pkg.BusinessService"> + <stdout> + <line text="42"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1923/gh322" vm="17" title="ajc error for particular Pointcut and @Deprecated"> + <!-- + <compile files="TheClass.java TheInterface.java TheAspect.java SomeAnnotation.java" options="-17,-Xlint:ignore"> + </compile> + <compile files="TheInterface.java TheAspect.java SomeAnnotation.java TheClass.java" options="-17,-Xlint:ignore"> + </compile> + --> + <compile files="TheAspect.java SomeAnnotation.java TheClass.java TheInterface.java " options="-17,-Xlint:ignore"> + </compile> + <compile files="TheAspect.java SomeAnnotation.java TheClass.java TheInterface.java" options="-17,-Xlint:ignore"> + </compile> + </ajc-test> + + </suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml new file mode 100644 index 000000000..000719f38 --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1924/ajc1924.xml @@ -0,0 +1,59 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- + JDK 23 (https://openjdk.org/projects/jdk/24/): + 404: Generational Shenandoah (Experimental) + 450: Compact Object Headers (Experimental) + 472: Prepare to Restrict the Use of JNI + 475: Late Barrier Expansion for G1 + 478: Key Derivation Function API (Preview) + 479: Remove the Windows 32-bit x86 Port + 483: Ahead-of-Time Class Loading & Linking + 484: Class-File API + 485: Stream Gatherers + 486: Permanently Disable the Security Manager + 487: Scoped Values (Fourth Preview) + 488: Primitive Types in Patterns, instanceof, and switch (Second Preview) + 489: Vector API (Ninth Incubator) + 490: ZGC: Remove the Non-Generational Mode + 491: Synchronize Virtual Threads without Pinning + 492: Flexible Constructor Bodies (Third Preview) + 493: Linking Run-Time Images without JMODs + 494: Module Import Declarations (Second Preview) + 495: Simple Source Files and Instance Main Methods (Fourth Preview) + 496: Quantum-Resistant Module-Lattice-Based Key Encapsulation Mechanism + 497: Quantum-Resistant Module-Lattice-Based Digital Signature Algorithm + 498: Warn upon Use of Memory-Access Methods in sun.misc.Unsafe + 499: Structured Concurrency (Fourth Preview) + 501: Deprecate the 32-bit x86 Port for Removal +--> +<suite> + + <!-- https://openjdk.org/jeps/455 --> + <ajc-test dir="features1923/java23" vm="24" title="primitive types patterns - switch - with advice"> + <compile files="PrimitivePatternsSwitch2.java" options="--enable-preview -24 -showWeaveInfo"> + <message kind="weave" line="12" text="Join point 'method-call(boolean PrimitivePatternsSwitch2.isOdd(int))' in Type 'PrimitivePatternsSwitch2' (PrimitivePatternsSwitch2.java:12) advised by around advice from 'X'"/>> + </compile> + <run class="PrimitivePatternsSwitch2" vmargs="--enable-preview"> + <stdout> + <!-- advice forces all the isOdd() calls to return false --> + <line text="no"/> + <line text="no"/> + <line text="no"/> + <line text="no"/> + </stdout> + </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> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1924/sanity-tests-24.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1924/sanity-tests-24.xml new file mode 100644 index 000000000..58af3b40b --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1924/sanity-tests-24.xml @@ -0,0 +1,68 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-24"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-24"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-24"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-24"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-24"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-24"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-24"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-24"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-24"/> + </ajc-test> + + <!-- check class file version --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-24"/> + </ajc-test> + + <!-- check class file version --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 24"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.8"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-24"/> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/resources/org/aspectj/systemtest/tracing/tracing.xml b/tests/src/test/resources/org/aspectj/systemtest/tracing/tracing.xml index b31370543..c89b8a372 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/tracing/tracing.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/tracing/tracing.xml @@ -44,6 +44,10 @@ writer --> <stderr> + <line text="WARNING: A terminally deprecated method in sun.misc.Unsafe has been called" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: Please consider reporting this to the maintainers of class org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor" vm="24"/> + <line text="WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release" vm="24"/> <line text="info AspectJ Weaver Version"/> <line text="info register classloader"/> <line text="info using configuration"/> |