aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-04-03 10:23:44 -0700
committerAndy Clement <aclement@pivotal.io>2019-04-03 10:23:44 -0700
commit0e2c95a36900fe913f5d768e7f4632034ddf005b (patch)
treef7f1bb92dfbae87de0a8998491e863490984aa0a /testing
parentdbb2c59fcfa6837f1fde9e0c1f0d04751c9268ee (diff)
downloadaspectj-0e2c95a36900fe913f5d768e7f4632034ddf005b.tar.gz
aspectj-0e2c95a36900fe913f5d768e7f4632034ddf005b.zip
Updated with Java12 support
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/AjcTest.java5
-rw-r--r--testing/src/test/java/org/aspectj/testing/AntSpec.java8
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java15
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java6
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java31
5 files changed, 59 insertions, 6 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java
index 4cb9a8722..0384e775d 100644
--- a/testing/src/test/java/org/aspectj/testing/AjcTest.java
+++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java
@@ -1,5 +1,5 @@
/* *******************************************************************
- * Copyright (c) 2004,2018 IBM Corporation, contributors
+ * Copyright (c) 2004,2019 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
@@ -29,6 +29,7 @@ public class AjcTest {
private static boolean is19VMOrGreater = false;
private static boolean is10VMOrGreater = false;
private static boolean is11VMOrGreater = false;
+ private static boolean is12VMOrGreater = false;
static { // matching logic is also in org.aspectj.util.LangUtil
is14VMOrGreater = LangUtil.is14VMOrGreater();
@@ -39,6 +40,7 @@ public class AjcTest {
is19VMOrGreater = LangUtil.is19VMOrGreater();
is10VMOrGreater = LangUtil.is10VMOrGreater();
is11VMOrGreater = LangUtil.is11VMOrGreater();
+ is12VMOrGreater = LangUtil.is12VMOrGreater();
}
private List<ITestStep> testSteps = new ArrayList<ITestStep>();
@@ -84,6 +86,7 @@ public class AjcTest {
if (vmLevel.equals("1.9")) canRun = is19VMOrGreater;
if (vmLevel.equals("10")) canRun = is10VMOrGreater;
if (vmLevel.equals("11")) canRun = is11VMOrGreater;
+ if (vmLevel.equals("12")) canRun = is12VMOrGreater;
if (!canRun) {
System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel()
+ ", currently running on " + System.getProperty("java.vm.version"));
diff --git a/testing/src/test/java/org/aspectj/testing/AntSpec.java b/testing/src/test/java/org/aspectj/testing/AntSpec.java
index bd0301d28..64ff4f364 100644
--- a/testing/src/test/java/org/aspectj/testing/AntSpec.java
+++ b/testing/src/test/java/org/aspectj/testing/AntSpec.java
@@ -207,7 +207,7 @@ public class AntSpec implements ITestStep {
}
if (m_stdErrSpec != null) {
String stderr2 = stderr.toString();
- // Working around this rediculous message that still comes out of Java7 builds:
+ // Working around this ridiculous message that still comes out of Java7 builds:
if (stderr2.indexOf("Class JavaLaunchHelper is implemented in both")!=-1 && stderr2.indexOf('\n')!=-1) {
stderr2 = stderr2.replaceAll("objc\\[[0-9]*\\]: Class JavaLaunchHelper is implemented in both [^\n]*\n","");
}
@@ -225,7 +225,11 @@ public class AntSpec implements ITestStep {
stderr2 = stderr2.replaceAll("WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations\n","");
stderr2 = stderr2.replaceAll("WARNING: All illegal access operations will be denied in a future release\n","");
}
-
+ // J12
+ String msg = "Java HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = \"org.aspectj.weaver.loadtime.WeavingURLClassLoader\"). To use archived non-system classes, this property must not be set";
+ if (stderr2.contains(msg)) {
+ stderr2 = stderr2.replace(msg+"\n","");
+ }
m_stdErrSpec.matchAgainst(stderr2);
}
}
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java
index 44c4ed5d8..94d31833a 100644
--- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java
@@ -208,6 +208,21 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase {
return result;
}
+ protected void checkVersion(String classname, int major, int minor) {
+ JavaClass jc;
+ try {
+ jc = getClassFrom(ajc.getSandboxDirectory(), classname);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalStateException("Cannot find class "+classname,e);
+ }
+ if (jc.getMajor() != major) {
+ fail("Expected major version to be " + major + " but was " + jc.getMajor());
+ }
+ if (jc.getMinor() != minor) {
+ fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
+ }
+ }
+
/*
* The rules for parsing a suite spec file. The Digester using bean properties to match attributes in the XML document to
* properties in the associated classes, so this simple implementation should be very easy to maintain and extend should you
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java
index b71fc19e9..18181d60e 100644
--- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.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,7 @@ public abstract class XMLBasedAjcTestCaseForJava11OrLater extends XMLBasedAjcTes
@Override
public void runTest(String title) {
- // Check we are on Java11
- String property = System.getProperty("java.version");
- if (!property.startsWith("11")) {
+ if (!LangUtil.is11VMOrGreater()) {
throw new IllegalStateException("These tests should be run on Java 11 or later");
}
super.runTest(title);
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java
new file mode 100644
index 000000000..c3242a36b
--- /dev/null
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.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;
+
+import org.aspectj.util.LangUtil;
+
+/**
+ * Ensure sure tests are running on the right level of JDK.
+ *
+ * @author Andy Clement
+ */
+public abstract class XMLBasedAjcTestCaseForJava12OrLater extends XMLBasedAjcTestCase {
+
+ @Override
+ public void runTest(String title) {
+ if (!LangUtil.is12VMOrGreater()) {
+ throw new IllegalStateException("These tests should be run on Java 12 or later");
+ }
+ super.runTest(title);
+ }
+
+}