diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-21 02:16:20 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-21 02:16:20 +0700 |
commit | 68ad86eb6ed70c15ad4209295903a9a977b001f6 (patch) | |
tree | e65d53e92cf4136d76337bd5e6f8e55da958fff5 /tests/src/test/resources | |
parent | a1867b05ba6443d32abc4049c26b92fc226d6f78 (diff) | |
download | aspectj-68ad86eb6ed70c15ad4209295903a9a977b001f6.tar.gz aspectj-68ad86eb6ed70c15ad4209295903a9a977b001f6.zip |
Add Java 16 test suite for AspectJ 1.9.7 + test refactorings
- Test all features which were preview in 14+15 and are now final in 16,
compiling them with language level 16.
- For Java 15 we only have sanity tests (and of course the Java <14
tests), compiling Java 16 features to target 15 does not seem to work.
- Test remaining Java 16 preview feature (sealed classes).
- Instead of overriding runTest(String) in several base classes like
XMLBasedAjcTestCaseForJava*Only or XMLBasedAjcTestCaseForJava*OrLater,
we now override setUp() from JUnit's TestCase base class. This will
run before runTest(String) and make the tests fail much faster, if a
user tries to run them on the wrong VM.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test/resources')
-rw-r--r-- | tests/src/test/resources/org/aspectj/systemtest/ajc197/ajc197.xml | 81 | ||||
-rw-r--r-- | tests/src/test/resources/org/aspectj/systemtest/ajc197/sanity-tests-16.xml | 69 |
2 files changed, 109 insertions, 41 deletions
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc197/ajc197.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc197/ajc197.xml index 6f6edaff5..7ba29cde5 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc197/ajc197.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc197/ajc197.xml @@ -2,9 +2,10 @@ <suite> - <ajc-test dir="features197/java15" vm="15" title="hidden class"> - <compile files="HiddenClassDemo.java" options="-15" /> - <compile files="HiddenClass.java" options="-15 -outjar hidden.jar"/> + <!-- Java 15 final, no preview --> + <ajc-test dir="features197/java15" vm="16" title="hidden class"> + <compile files="HiddenClassDemo.java" options="-16" /> + <compile files="HiddenClass.java" options="-16 -outjar hidden.jar"/> <run class="HiddenClassDemo" classpath="hidden.jar"> <stdout> <line text="Hidden class name = HiddenClass/" /> @@ -15,14 +16,15 @@ </run> </ajc-test> - <ajc-test dir="features196/java14" vm="15" title="simple record"> - <compile files="Person.java" options="--enable-preview -15" /> + <!-- Java 16 final, Java 15, 14 preview --> + <ajc-test dir="features196/java14" vm="16" title="simple record"> + <compile files="Person.java" options="-16" /> </ajc-test> - <ajc-test dir="features196/java14" vm="15" title="using a record"> - <compile files="Person.java UsingPersonRecord.java" - options="--enable-preview -15" /> - <run class="UsingPersonRecord" vmargs="--enable-preview"> + <!-- Java 16 final, Java 15, 14 preview --> + <ajc-test dir="features196/java14" vm="16" title="using a record"> + <compile files="Person.java UsingPersonRecord.java" options="-16" /> + <run class="UsingPersonRecord"> <stdout> <line text="Person[firstName=A, lastName=B, age=99]" /> <line text="A" /> @@ -30,37 +32,33 @@ </run> </ajc-test> - <ajc-test dir="features196/java14" vm="15" - title="instanceof patterns"> - <compile files="Jep305.java" options="--enable-preview -15" /> - <run class="Jep305" vmargs="--enable-preview"> + <!-- Java 16 final, Java 15, 14 preview --> + <ajc-test dir="features196/java14" vm="16" title="advising records"> + <compile files="TraceRecordComponents.aj Person.java UsingPersonRecord.java" options="-16" /> + <run class="UsingPersonRecord"> <stdout> - <line text="orange" /> - <line text="apple" /> + <line text="execution(String Person.toString())" /> + <line text="Person[firstName=A, lastName=B, age=99]" /> + <line text="execution(String Person.firstName())" /> + <line text="A" /> </stdout> </run> </ajc-test> - <ajc-test dir="features196/java14" vm="15" - title="advising records"> - <compile - files="TraceRecordComponents.aj Person.java UsingPersonRecord.java" - options="--enable-preview -15" /> - <run class="UsingPersonRecord" vmargs="--enable-preview"> + <!-- Java 16 final, Java 15, 14 preview --> + <ajc-test dir="features196/java14" vm="16" title="instanceof patterns"> + <compile files="Jep305.java" options="-16" /> + <run class="Jep305"> <stdout> - <line text="execution(String Person.toString())" /> - <line text="Person[firstName=A, lastName=B, age=99]" /> - <line text="execution(String Person.firstName())" /> - <line text="A" /> + <line text="orange" /> + <line text="apple" /> </stdout> </run> </ajc-test> - <!-- textblock now in Java15 and doesn't need -enable-preview flag --> - <ajc-test dir="features195/textblock" vm="15" - title="textblock 1"> - <compile files="Code.java" - options="-source 15"> + <!-- Java 15 final, Java 14, 13 preview --> + <ajc-test dir="features195/textblock" vm="16" title="textblock 1"> + <compile files="Code.java" options="-source 16"> </compile> <run class="Code"> <stdout> @@ -70,11 +68,9 @@ </run> </ajc-test> - <!-- textblock now in Java15 and doesn't need -enable-preview flag --> - <ajc-test dir="features195/textblock" vm="15" - title="textblock 2"> - <compile files="Code2.java" - options="-source 15"> + <!-- Java 15 final, Java 14, 13 preview --> + <ajc-test dir="features195/textblock" vm="16" title="textblock 2"> + <compile files="Code2.java" options="-source 16"> </compile> <run class="Code2"> <stdout> @@ -84,18 +80,21 @@ </run> </ajc-test> - <ajc-test dir="features197/java15" vm="15" title="sealed class with legal subclasses"> - <compile files="Person.java Employee.java Manager.java" options="--enable-preview -15" /> + <!-- Java ?? final, Java 16, 15 preview --> + <ajc-test dir="features197/java15" vm="16" title="sealed class with legal subclasses"> + <compile files="Person.java Employee.java Manager.java" options="--enable-preview -16" /> </ajc-test> - <ajc-test dir="features197/java15" vm="15" title="sealed class with illegal subclass"> - <compile files="Person.java Employee.java Manager.java PersonaNonGrata.java" options="--enable-preview -15"> + <!-- Java ?? final, Java 16, 15 preview --> + <ajc-test dir="features197/java15" vm="16" title="sealed class with illegal subclass"> + <compile files="Person.java Employee.java Manager.java PersonaNonGrata.java" options="--enable-preview -16"> <message kind="error" file="PersonaNonGrata.java" text="should be a permitted subtype of Person"/> </compile> </ajc-test> - <ajc-test dir="features197/java15" vm="15" title="weave sealed class"> - <compile files="Person.java Employee.java Manager.java TopManager.java PersonAspect.aj" options="--enable-preview -15" /> + <!-- Java ?? final, Java 16, 15 preview --> + <ajc-test dir="features197/java15" vm="16" title="weave sealed class"> + <compile files="Person.java Employee.java Manager.java TopManager.java PersonAspect.aj" options="--enable-preview -16" /> <run class="TopManager" vmargs="--enable-preview"> <stdout> <line text="Hello Sir John" /> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc197/sanity-tests-16.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc197/sanity-tests-16.xml new file mode 100644 index 000000000..d6cb9ab8b --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc197/sanity-tests-16.xml @@ -0,0 +1,69 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-16"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-16"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-16"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-16"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-16"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-16"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-16"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-16"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-16"/> + </ajc-test> + + <!-- check class file version is 60.0 (Java 16) --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-16"/> + </ajc-test> + + <!-- check class file version is 60.0 (Java 16) --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 16"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-16"/> + </ajc-test> +</suite> |