aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2023-10-05 11:29:04 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2023-10-05 11:29:04 +0700
commit72171c3724100618bf2c733316d23ff7578eeaa1 (patch)
tree9ee595318fd7a6c53578a1731b909cc89966b6b9 /tests/src/test/java/org/aspectj
parent99f426e351b62310ce3c31348594b106a4bf624e (diff)
downloadaspectj-72171c3724100618bf2c733316d23ff7578eeaa1.tar.gz
aspectj-72171c3724100618bf2c733316d23ff7578eeaa1.zip
Make all existing tests run on JDK 21
This mostly affects pattern matching for switch and record patterns. Two tests which were working before for pattern matching for switch (preview 4), started to fail, so the corresponding code was commented out and https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1466 recorded. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test/java/org/aspectj')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java75
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java73
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java75
3 files changed, 77 insertions, 146 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java
index e7d3b9596..20efe1723 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Ajc1921TestsJava.java
@@ -8,6 +8,7 @@
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;
@@ -16,8 +17,78 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater;
*/
public class Ajc1921TestsJava extends XMLBasedAjcTestCaseForJava21OrLater {
- public void testDummyJava21() {
- //runTest("dummy Java 21");
+ public void testSwitchPatternMatchingPreview4Java() {
+ runTest("switch pattern matching preview 4 java");
+ checkVersion("SwitchPatternPreview4OK", Constants.MAJOR_21, Constants.MINOR_21);
+ }
+
+ 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.MINOR_21);
+ checkVersion("Application", Constants.MAJOR_21, Constants.MINOR_21);
+ checkVersion("Shape", Constants.MAJOR_21, Constants.MINOR_21);
+ checkVersion("S", Constants.MAJOR_21, Constants.MINOR_21);
+ }
+
+ 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.MINOR_21);
+ checkVersion("Box", Constants.MAJOR_21, Constants.MINOR_21);
+ }
+
+ 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() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java
index 3c11149d3..113731a4f 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Bugs1921Tests.java
@@ -15,77 +15,8 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
*/
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.
- * <p>
- * See <a href="https://github.com/eclipse-aspectj/aspectj/issues/246">GitHub issue 246</a>.
- */
- 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.
- * <p>
- * See <a href="https://github.com/eclipse-aspectj/aspectj/issues/250">GitHub issue 250</a>.
- */
- 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.
- * <p>
- * See <a href="https://github.com/spring-projects/spring-framework/issues/27761">Spring GitHub issue 27761</a>.
- * <p>
- * This test uses an ASM-modified class file reproducing the problem seen in Spring in plain AspectJ. Before the
- * bugfix, it fails with <b>"advice defined in RepositoryAspect has not been applied [Xlint:adviceDidNotMatch]".</b>
- */
- 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.
- * <p>
- * See <a href="https://github.com/eclipse-aspectj/aspectj/issues/257">GitHub issue 257</a>.
- */
- public void test_GitHub_257() {
- runTest("handle negated type patterns correctly");
+ public void testDummy() {
+ //runTest("dummy");
}
public static Test suite() {
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java
index 1088aac63..4b4de845d 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/Java21PreviewFeaturesTests.java
@@ -8,7 +8,6 @@
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;
@@ -17,78 +16,8 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava21Only;
*/
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 void testDummyPreviewJava21() {
+ //runTest("dummy preview Java 21");
}
public static Test suite() {