diff options
author | Andy Clement <aclement@pivotal.io> | 2018-04-18 13:15:22 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2018-04-18 13:15:22 -0700 |
commit | 836beab108ef4be8b59c1ad9c8596ce959bdf1c7 (patch) | |
tree | 9346f87088aceecb16fad6f3b70753235051f504 /testing | |
parent | b2cb18ef127097ad2c258b9d061cc70b5fb19432 (diff) | |
download | aspectj-836beab108ef4be8b59c1ad9c8596ce959bdf1c7.tar.gz aspectj-836beab108ef4be8b59c1ad9c8596ce959bdf1c7.zip |
Support Java10
Diffstat (limited to 'testing')
3 files changed, 39 insertions, 4 deletions
diff --git a/testing/newsrc/org/aspectj/testing/AjcTest.java b/testing/newsrc/org/aspectj/testing/AjcTest.java index 2cc450636..d56bc6e37 100644 --- a/testing/newsrc/org/aspectj/testing/AjcTest.java +++ b/testing/newsrc/org/aspectj/testing/AjcTest.java @@ -1,5 +1,5 @@ /* ******************************************************************* - * Copyright (c) 2004,2013 IBM Corporation, contributors + * Copyright (c) 2004,2018 IBM Corporation, contributors * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 @@ -27,6 +27,7 @@ public class AjcTest { private static boolean is17VMOrGreater = false; private static boolean is18VMOrGreater = false; private static boolean is19VMOrGreater = false; + private static boolean is10VMOrGreater = false; static { // matching logic is also in org.aspectj.util.LangUtil is14VMOrGreater = LangUtil.is14VMOrGreater(); @@ -35,6 +36,7 @@ public class AjcTest { is17VMOrGreater = LangUtil.is17VMOrGreater(); is18VMOrGreater = LangUtil.is18VMOrGreater(); is19VMOrGreater = LangUtil.is19VMOrGreater(); + is10VMOrGreater = LangUtil.is10VMOrGreater(); } private List<ITestStep> testSteps = new ArrayList<ITestStep>(); @@ -78,6 +80,7 @@ public class AjcTest { if (vmLevel.equals("1.7")) canRun = is17VMOrGreater; if (vmLevel.equals("1.8")) canRun = is18VMOrGreater; if (vmLevel.equals("1.9")) canRun = is19VMOrGreater; + if (vmLevel.equals("10")) canRun = is10VMOrGreater; if (!canRun) { System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel() + ", currently running on " + System.getProperty("java.vm.version")); diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java new file mode 100644 index 000000000..492106d4d --- /dev/null +++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java @@ -0,0 +1,31 @@ +/* ******************************************************************* + * Copyright (c) 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 + * + * Contributors: + * Andy Clement + * ******************************************************************/ +package org.aspectj.testing; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Andy Clement + */ +public abstract class XMLBasedAjcTestCaseForJava10OrLater extends XMLBasedAjcTestCase { + + @Override + public void runTest(String title) { + // Check we are on Java10 + String property = System.getProperty("java.version"); + if (!property.startsWith("10")) { + throw new IllegalStateException("These tests should be run on Java 10 or later"); + } + super.runTest(title); + } + +} diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java index 826cf55d3..205b55273 100644 --- a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java +++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java @@ -11,6 +11,8 @@ * ******************************************************************/ package org.aspectj.testing; +import org.aspectj.util.LangUtil; + /** * Makes sure tests are running on the right level of JDK. * @@ -20,9 +22,8 @@ public abstract class XMLBasedAjcTestCaseForJava9OrLater extends XMLBasedAjcTest @Override public void runTest(String title) { - // Check we are on Java9 - String property = System.getProperty("java.version"); - if (!property.startsWith("9")) { + // Check we are on Java9 or later + if (!LangUtil.is19VMOrGreater()) { throw new IllegalStateException("These tests should be run on Java 9 or later"); } super.runTest(title); |