summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2017-11-09 13:14:02 -0800
committerAndy Clement <aclement@pivotal.io>2017-11-09 13:14:02 -0800
commitd92319c43f5723d57887e09f2a839ee5b595fcfd (patch)
tree155e25d455e598ff5b55b0563645d4af23903bb4 /testing
parent6765fdc34c775e99799b36d88cff8ab88dffc8e7 (diff)
downloadaspectj-d92319c43f5723d57887e09f2a839ee5b595fcfd.tar.gz
aspectj-d92319c43f5723d57887e09f2a839ee5b595fcfd.zip
Updates to better cope with future JDKs
The version handling in LangUtil has been overhauled to cope better with post 1.8 releases (JDK9 and JDK10 or 18.3 or whatever they call it). As part of this moved to treating JDK9 as '9' rather than '1.9'. Also removed duplicate version processing logic and had that defer to the one place in LangUtil where we now deal with it. Includes some generics tidyup in ajdoc. More ajdoc work is necessary for Java10 because it removes the standard doclet (old style). However trying to invoke the internal Javadoc handler in Java10 is failing due to module visibility rules.
Diffstat (limited to 'testing')
-rw-r--r--testing/newsrc/org/aspectj/testing/AjcTest.java33
-rw-r--r--testing/newsrc/org/aspectj/testing/OutputSpec.java22
2 files changed, 28 insertions, 27 deletions
diff --git a/testing/newsrc/org/aspectj/testing/AjcTest.java b/testing/newsrc/org/aspectj/testing/AjcTest.java
index 29d3d1786..2cc450636 100644
--- a/testing/newsrc/org/aspectj/testing/AjcTest.java
+++ b/testing/newsrc/org/aspectj/testing/AjcTest.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.List;
import org.aspectj.tools.ajc.AjcTestCase;
+import org.aspectj.util.LangUtil;
/**
* @author Adrian Colyer
@@ -28,32 +29,12 @@ public class AjcTest {
private static boolean is19VMOrGreater = false;
static { // matching logic is also in org.aspectj.util.LangUtil
- String vm = System.getProperty("java.version"); // JLS 20.18.7
- if (vm==null) vm = System.getProperty("java.runtime.version");
- if (vm==null) vm = System.getProperty("java.vm.version");
- if (vm.startsWith("1.3")) {
- is14VMOrGreater = false;
- } else if (vm.startsWith("1.5")) {
- is15VMOrGreater = true;
- } else if (vm.startsWith("1.6")) {
- is15VMOrGreater = true;
- is16VMOrGreater = true;
- } else if (vm.startsWith("1.7")) {
- is15VMOrGreater = true;
- is16VMOrGreater = true;
- is17VMOrGreater = true;
- } else if (vm.startsWith("1.8")) {
- is15VMOrGreater = true;
- is16VMOrGreater = true;
- is17VMOrGreater = true;
- is18VMOrGreater = true;
- } else if (vm.startsWith("1.9") || vm.startsWith("9")) {
- is15VMOrGreater = true;
- is16VMOrGreater = true;
- is17VMOrGreater = true;
- is18VMOrGreater = true;
- is19VMOrGreater = true;
- }
+ is14VMOrGreater = LangUtil.is14VMOrGreater();
+ is15VMOrGreater = LangUtil.is15VMOrGreater();
+ is16VMOrGreater = LangUtil.is16VMOrGreater();
+ is17VMOrGreater = LangUtil.is17VMOrGreater();
+ is18VMOrGreater = LangUtil.is18VMOrGreater();
+ is19VMOrGreater = LangUtil.is19VMOrGreater();
}
private List<ITestStep> testSteps = new ArrayList<ITestStep>();
diff --git a/testing/newsrc/org/aspectj/testing/OutputSpec.java b/testing/newsrc/org/aspectj/testing/OutputSpec.java
index 4f978f6b6..9eab46098 100644
--- a/testing/newsrc/org/aspectj/testing/OutputSpec.java
+++ b/testing/newsrc/org/aspectj/testing/OutputSpec.java
@@ -23,11 +23,31 @@ public class OutputSpec {
private List<String> expectedOutputLines = new ArrayList<String>();
public void addLine(OutputLine line) {
- if (line.getVm() == null || line.getVm().contains(LangUtil.getVmVersionString())) {
+ if (line.getVm() == null || matchesThisVm(line.getVm())) {
expectedOutputLines.add(line.getText());
}
}
+ /**
+ * For a test output line that has specified a vm version, check if it matches the vm we are running on.
+ * vm might be "1.2,1.3,1.4,1.5" or simply "9" or it may be a version with a '+' suffix indicating that
+ * level or later, e.g. "9+" should be ok on Java 10
+ * @return true if the current vm version matches the spec
+ */
+ private boolean matchesThisVm(String vm) {
+ // vm might be 1.2, 1.3, 1.4, 1.5 or 1.9 possibly with a '+' in there
+ // For now assume + is attached to there only being one version, like "9+"
+ if (vm.contains(LangUtil.getVmVersionString())) {
+ return true;
+ }
+ if (vm.endsWith("+")) {
+ double vmVersion = LangUtil.getVmVersion();
+ double vmSpecified = Double.parseDouble(vm.substring(0,vm.length()-1));
+ return vmVersion >= vmSpecified;
+ }
+ return false;
+ }
+
public void matchAgainst(String output) {
matchAgainst(output, "yes");
}