diff options
author | Andy Clement <aclement@pivotal.io> | 2019-11-25 10:40:44 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-11-25 10:40:44 -0800 |
commit | 2704db20ecca12d3bbe514a4f7b84d297937de86 (patch) | |
tree | 2938cb6c560d2ea220272af703452ccd096702ca /tests | |
parent | 41c7347b064093b531b04004d42665582ba0fff0 (diff) | |
download | aspectj-2704db20ecca12d3bbe514a4f7b84d297937de86.tar.gz aspectj-2704db20ecca12d3bbe514a4f7b84d297937de86.zip |
Java 13 support
Diffstat (limited to 'tests')
6 files changed, 172 insertions, 12 deletions
diff --git a/tests/pom.xml b/tests/pom.xml index 7e65f2f0f..c91ffffe0 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -55,7 +55,7 @@ <artifactId>asm</artifactId> <version>1.0</version> <scope>system</scope> - <systemPath>${project.basedir}/../lib/asm/asm-7.0-beta.renamed.jar</systemPath> + <systemPath>${project.basedir}/../lib/asm/asm-7.2.renamed.jar</systemPath> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java index 72388ba68..9a36d3daf 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java @@ -5,7 +5,7 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ -package org.aspectj.systemtest.ajc193; +package org.aspectj.systemtest.ajc193; import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; @@ -15,22 +15,22 @@ import junit.framework.Test; /** * @author Andy Clement - */ + */ public class Java12Tests extends XMLBasedAjcTestCaseForJava12OrLater { public void testSwitch1() { runTest("switch 1"); - checkVersion("Switch1", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Switch1", Constants.MAJOR_13, Constants.PREVIEW_MINOR_VERSION); } public void testSwitch2() { runTest("switch 2"); - checkVersion("Switch2", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Switch2", Constants.MAJOR_13, Constants.PREVIEW_MINOR_VERSION); } public void testSwitch3() { runTest("switch 3"); - checkVersion("Switch3", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Switch3", Constants.MAJOR_13, Constants.PREVIEW_MINOR_VERSION); } // --- diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java b/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java index a7eb6604e..8a714a606 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java @@ -18,6 +18,7 @@ public class AllTestsAspectJ195 { public static Test suite() { TestSuite suite = new TestSuite("AspectJ 1.9.4 tests"); suite.addTest(Ajc195Tests.suite()); + suite.addTest(SanityTestsJava13.suite()); return suite; } } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java b/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java new file mode 100644 index 000000000..89ac25e07 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2006, 2018 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package org.aspectj.systemtest.ajc195; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava13OrLater; + +import junit.framework.Test; + +/* + * 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 -10 option + * to check code generation and modification with that version specified. + * + * @author Andy Clement + */ +public class SanityTestsJava13 extends XMLBasedAjcTestCaseForJava13OrLater { + + public static final int bytecode_version_for_JDK_level = 57; + + // 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() throws ClassNotFoundException { + runTest("simple - j"); + checkVersion("A", bytecode_version_for_JDK_level, 0); + } + + public void testVersionCorrect2() throws ClassNotFoundException { + runTest("simple - k"); + checkVersion("A", bytecode_version_for_JDK_level, 0); + } + + public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified + runTest("simple - m"); + checkVersion("A", 49, 0); + } + + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava13.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-13.xml"); + } + +} diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml index c13159c30..cea315f82 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml @@ -51,8 +51,9 @@ Method call </run> </ajc-test> - <ajc-test dir="features193" vm="12" title="switch 1"> - <compile files="Switch1.java" options="-12 --enable-preview"> + <!-- with the release of 13 this behaviour seems to have moved from 12 to 13?? --> + <ajc-test dir="features193" vm="13" title="switch 1"> + <compile files="Switch1.java" options="-13 --enable-preview"> </compile> <run class="Switch1" vmargs="--enable-preview"> <stdout> @@ -64,8 +65,8 @@ Method call </run> </ajc-test> - <ajc-test dir="features193" vm="12" title="switch 2"> - <compile files="Switch2.java" options="--enable-preview -source 12"> + <ajc-test dir="features193" vm="13" title="switch 2"> + <compile files="Switch2.java" options="--enable-preview -source 13"> </compile> <run class="Switch2" vmargs="--enable-preview"> <stdout> @@ -77,8 +78,8 @@ Method call </run> </ajc-test> - <ajc-test dir="features193" vm="12" title="switch 3"> - <compile files="Switch3.java" options="--enable-preview -source 12"> + <ajc-test dir="features193" vm="13" title="switch 3"> + <compile files="Switch3.java" options="--enable-preview -source 13"> </compile> <run class="Switch3" vmargs="--enable-preview"> <stdout> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc195/sanity-tests-13.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc195/sanity-tests-13.xml new file mode 100644 index 000000000..3a83e1108 --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc195/sanity-tests-13.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="-13"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-13"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-13"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-13"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-13"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-13"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-13"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-13"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-13"/> + </ajc-test> + + <!-- check class file version is 57.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-13"/> + </ajc-test> + + <!-- check class file version is 57.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 13"/> + </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="-13"/> + </ajc-test> +</suite> |