Replace them by a uniform method 'isVMGreaterOrEqual(double)', also overloaded for int. This gets rid of one 'AspectJ_JDK_Update' tag. One less place to check and update with each newly supported Java version. :-) Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>tags/V1_9_21_2
@@ -61,7 +61,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { | |||
public String getClasspath() { | |||
StringBuilder classpath = new StringBuilder(); | |||
classpath.append(projectPath); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
classpath.append(File.pathSeparator).append(LangUtil.getJrtFsFilePath()); | |||
} else { | |||
classpath.append(File.pathSeparator).append(System.getProperty("sun.boot.class.path")); |
@@ -67,7 +67,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { | |||
public String getClasspath() { | |||
String cp = projectPath + File.pathSeparator + System.getProperty("sun.boot.class.path") + File.pathSeparator | |||
+ TestUtil.aspectjrtClasspath(); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
cp = LangUtil.getJrtFsFilePath()+File.pathSeparator+cp; | |||
} | |||
return cp; |
@@ -43,16 +43,16 @@ class HtmlDecorator { | |||
public static final String CLOSING_SPAN; | |||
static { | |||
if (LangUtil.is16VMOrGreater()) | |||
if (LangUtil.isVMGreaterOrEqual(16)) | |||
TYPE_NAME_LABEL = "element-name type-name-label"; | |||
else if (LangUtil.is15VMOrGreater()) | |||
else if (LangUtil.isVMGreaterOrEqual(15)) | |||
TYPE_NAME_LABEL = "type-name-label"; | |||
else if (LangUtil.is1dot8VMOrGreater()) | |||
else if (LangUtil.isVMGreaterOrEqual(1.8)) | |||
TYPE_NAME_LABEL = "typeNameLabel"; | |||
else | |||
TYPE_NAME_LABEL = "strong"; | |||
if (LangUtil.is16VMOrGreater()) | |||
if (LangUtil.isVMGreaterOrEqual(16)) | |||
CLOSING_SPAN = "</span>"; | |||
else | |||
CLOSING_SPAN = ""; |
@@ -265,7 +265,7 @@ public class Main implements Config { | |||
for (int k = 0; k < fileList.size(); k++) { | |||
javadocargs[numExtraArgs + options.size() + packageList.size() + k] = fileList.elementAt(k); | |||
} | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
options = new Vector<>(); | |||
Collections.addAll(options, javadocargs); | |||
} | |||
@@ -289,7 +289,7 @@ public class Main implements Config { | |||
Locale defaultLocale = Locale.getDefault(); | |||
try { | |||
Locale.setDefault(Locale.ENGLISH); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
JavadocRunner.callJavadocViaToolProvider(options, files); | |||
} else { | |||
JavadocRunner.callJavadoc(javadocargs); |
@@ -206,7 +206,7 @@ public class AjdocOutputChecker { | |||
String nextLine = reader.readLine(); | |||
while (nextLine != null && (!nextLine.contains("========"))) { | |||
// On JDK11 it looks like <a id="doIt()"> on earlier JDKs it can look like <a name="doit"> | |||
if ((LangUtil.is11VMOrGreater() && nextLine.contains("ID=\"" + source + "\"") || nextLine.contains("id=\"" + source + "\"")) || | |||
if ((LangUtil.isVMGreaterOrEqual(11) && nextLine.contains("ID=\"" + source + "\"") || nextLine.contains("id=\"" + source + "\"")) || | |||
nextLine.contains("NAME=\"" + source + "\"") || nextLine.contains("name=\"" + source + "\"")) { | |||
// found the required subsection | |||
String subLine = reader.readLine(); |
@@ -219,7 +219,7 @@ public abstract class AjdocTestCase extends TestCase { | |||
args[2] = sourceLevel; | |||
args[3] = "-classpath"; | |||
StringBuilder classpath = new StringBuilder(); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
classpath.append(LangUtil.getJrtFsFilePath()).append(File.pathSeparator); | |||
} | |||
classpath.append(AjdocTests.ASPECTJRT_PATH.getPath()); |
@@ -319,7 +319,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
} | |||
String[] strings = { | |||
LangUtil.is11VMOrGreater()?"<init>()":toName("Point()"), | |||
LangUtil.isVMGreaterOrEqual(11)?"<init>()":toName("Point()"), | |||
"HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): constructorExecutionP..\""}; | |||
boolean b = AjdocOutputChecker.detailSectionContainsRel( | |||
htmlFile,"=== CONSTRUCTOR DETAIL", | |||
@@ -336,7 +336,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
// <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">Point</a></span>()</code></th> | |||
b = AjdocOutputChecker.summarySectionContainsRel( | |||
htmlFile,"=== CONSTRUCTOR SUMMARY", | |||
LangUtil.is11VMOrGreater()?"#%3Cinit%3E()":toName("Point()"), | |||
LangUtil.isVMGreaterOrEqual(11)?"#%3Cinit%3E()":toName("Point()"), | |||
HtmlDecorator.HtmlRelationshipKind.ADVISED_BY, | |||
strings[1]); | |||
assertTrue("the Constructor Summary should have " + strings[0]+" advised by " + strings[1],b); | |||
@@ -465,14 +465,14 @@ public class CoverageTestCase extends AjdocTestCase { | |||
b = AjdocOutputChecker.detailSectionContainsRel( | |||
htmlFile,"=== CONSTRUCTOR DETAIL", | |||
LangUtil.is11VMOrGreater()?"<init>()":toName("Point()"), | |||
LangUtil.isVMGreaterOrEqual(11)?"<init>()":toName("Point()"), | |||
HtmlDecorator.HtmlRelationshipKind.ADVISED_BY, | |||
href); | |||
assertTrue("the Constructor Detail should have advised by " + href,b); | |||
b = AjdocOutputChecker.summarySectionContainsRel( | |||
htmlFile,"=== CONSTRUCTOR SUMMARY", | |||
LangUtil.is11VMOrGreater()?"#%3Cinit%3E()":toName("Point()"), | |||
LangUtil.isVMGreaterOrEqual(11)?"#%3Cinit%3E()":toName("Point()"), | |||
HtmlDecorator.HtmlRelationshipKind.ADVISED_BY, | |||
href); | |||
assertTrue("the Constructor Summary should have advised by " + href,b); | |||
@@ -498,7 +498,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
} | |||
String[] strings = { | |||
LangUtil.is11VMOrGreater()?"<init>()":toName("Point()"), | |||
LangUtil.isVMGreaterOrEqual(11)?"<init>()":toName("Point()"), | |||
"HREF=\"../foo/AdvisesRelationshipCoverage.html#before(): initializationP..\""}; | |||
boolean b = AjdocOutputChecker.detailSectionContainsRel( | |||
htmlFile, | |||
@@ -510,7 +510,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
b = AjdocOutputChecker.summarySectionContainsRel( | |||
htmlFile, | |||
"=== CONSTRUCTOR SUMMARY", | |||
LangUtil.is11VMOrGreater()?"#%3Cinit%3E()":strings[0], | |||
LangUtil.isVMGreaterOrEqual(11)?"#%3Cinit%3E()":strings[0], | |||
HtmlDecorator.HtmlRelationshipKind.ADVISED_BY, | |||
strings[1]); | |||
assertTrue("the Method Summary should have 'setX(int) advised by ... before()'",b); | |||
@@ -569,7 +569,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
} | |||
private String toName(String name) { | |||
if (!LangUtil.is11VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(11)) { | |||
name = name.replace('(','-'); | |||
name = name.replace(')','-'); | |||
} | |||
@@ -692,7 +692,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
// ensure that the file is entitled "Class PkgVisibleClass" and | |||
// has not been changed to "Aspect PkgVisibleClass" | |||
String[] classStrings = null; | |||
if (LangUtil.is13VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(13)) { | |||
classStrings = new String[] { | |||
"Class PkgVisibleClass</h1>", | |||
"class " + CLOSING_SPAN + "<span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass</span>", | |||
@@ -757,7 +757,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
// ensure that the file is entitled "Class ClassWithNestedAspect" and | |||
// has not been changed to "Aspect ClassWithNestedAspect" | |||
String[] classStrings = null; | |||
if (LangUtil.is13VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(13)) { | |||
classStrings = new String[] { | |||
"Class ClassWithNestedAspect</h1>", | |||
"public class " + CLOSING_SPAN + "<span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>", |
@@ -159,7 +159,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
boolean b = AjdocOutputChecker.detailSectionContainsRel( | |||
htmlFile,"=== METHOD DETAIL", | |||
toName("setX(int)"), | |||
// LangUtil.is18VMOrGreater()?"setX-int-":"setX(int)", | |||
// LangUtil.isVMGreaterOrEqual(18)?"setX-int-":"setX(int)", | |||
HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE, | |||
"declare warning: quot;blahquot;"); | |||
assertTrue("Should have 'setX(int) matches declare declare warning: quot;blahquot;" + | |||
@@ -167,7 +167,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
b = AjdocOutputChecker.summarySectionContainsRel( | |||
htmlFile,"=== METHOD SUMMARY", | |||
toName("setX(int)"), | |||
// LangUtil.is18VMOrGreater()?"setX-int-":"setX(int)", | |||
// LangUtil.isVMGreaterOrEqual(18)?"setX-int-":"setX(int)", | |||
HtmlDecorator.HtmlRelationshipKind.MATCHES_DECLARE, | |||
"declare warning: quot;blahquot;"); | |||
assertTrue("Should have 'setX(int) matches declare declare warning: quot;blahquot;" + | |||
@@ -291,7 +291,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
} | |||
private String toName(String name) { | |||
if (!LangUtil.is11VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(11)) { | |||
name = name.replace('(','-'); | |||
name = name.replace(')','-'); | |||
} | |||
@@ -394,7 +394,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
boolean b = AjdocOutputChecker.detailSectionContainsRel( | |||
htmlFile,"=== CONSTRUCTOR DETAIL", | |||
LangUtil.is11VMOrGreater()?"<init>(java.lang.String)":toName("C(java.lang.String)"), | |||
LangUtil.isVMGreaterOrEqual(11)?"<init>(java.lang.String)":toName("C(java.lang.String)"), | |||
HtmlDecorator.HtmlRelationshipKind.ANNOTATED_BY, | |||
"declare @constructor: foo.C.new(..) : @MyAnnotation"); | |||
assertTrue("Should have '" + doIt + " annotated by " + | |||
@@ -402,7 +402,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
"' in the Method Detail section", b); | |||
b = AjdocOutputChecker.summarySectionContainsRel( | |||
htmlFile,"=== CONSTRUCTOR SUMMARY", | |||
LangUtil.is11VMOrGreater()?"#%3Cinit%3E(java.lang.String)":toName("C(java.lang.String)"), | |||
LangUtil.isVMGreaterOrEqual(11)?"#%3Cinit%3E(java.lang.String)":toName("C(java.lang.String)"), | |||
HtmlDecorator.HtmlRelationshipKind.ANNOTATED_BY, | |||
"declare @constructor: foo.C.new(..) : @MyAnnotation"); | |||
assertTrue("Should have '" + doIt + " annotated by " + |
@@ -45,7 +45,7 @@ public class VersionTest extends TestCase { | |||
} | |||
public void testVersion() { | |||
if (LangUtil.is11VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
return; | |||
} | |||
if (Version.getTimeText().equals("")) { |
@@ -350,7 +350,7 @@ public class BuildArgParser extends Main { | |||
List<String> ret = new ArrayList<>(); | |||
if (parser.bootclasspath == null) { | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
addClasspath(LangUtil.getJrtFsFilePath(),ret); | |||
} else { | |||
addClasspath(System.getProperty("sun.boot.class.path", ""), ret); |
@@ -169,7 +169,7 @@ public abstract class CommandTestCase extends TestCase { | |||
/** get the location of the org.aspectj.lang & runtime classes */ | |||
protected static String getRuntimeClasspath() { | |||
StringBuilder classpath = new StringBuilder(); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
classpath.append(LangUtil.getJrtFsFilePath()).append(File.pathSeparator); | |||
} | |||
classpath.append(Constants.aspectjrtClasspath()); |
@@ -960,7 +960,7 @@ public abstract class AjcTestCase extends TestCase { | |||
args = newargs; | |||
} | |||
} | |||
boolean needsJRTFS = LangUtil.is9VMOrGreater(); | |||
boolean needsJRTFS = LangUtil.isVMGreaterOrEqual(9); | |||
if (needsJRTFS) { | |||
if (!args[cpIndex].contains(LangUtil.JRT_FS)) { | |||
String jrtfsPath = LangUtil.getJrtFsFilePath(); |
@@ -81,7 +81,7 @@ public class ReflectionWorld extends World implements IReflectionWorld { | |||
private ReflectionWorld() { | |||
// super(); | |||
// this.setMessageHandler(new ExceptionBasedMessageHandler()); | |||
// setBehaveInJava5Way(LangUtil.is15VMOrGreater()); | |||
// setBehaveInJava5Way(LangUtil.isVMGreaterOrEqual(15)); | |||
// this.classLoaderReference = new | |||
// WeakClassLoaderReference(ReflectionWorld.class.getClassLoader()); | |||
// this.annotationFinder = |
@@ -528,7 +528,7 @@ public abstract class CommonAdvancedPointcutExpressionTests extends TestCase { | |||
// assertFalse("Matches maybe", ex.matchesMethodExecution(foo).alwaysMatches()); | |||
// // never match | |||
// ex = p.parsePointcutExpression("args(String,Integer,Number)"); | |||
// if (LangUtil.is15VMOrGreater()) { | |||
// if (LangUtil.isVMGreaterOrEqual(15)) { | |||
// assertTrue("matches", ex.matchesMethodExecution(foo).alwaysMatches()); | |||
// } else { | |||
// assertTrue("Does not match", ex.matchesMethodExecution(foo).neverMatches()); |
@@ -660,7 +660,7 @@ public abstract class CommonPointcutExpressionTests extends TestCase { | |||
// assertFalse("Matches maybe", ex.matchesMethodExecution(foo).alwaysMatches()); | |||
// // never match | |||
// ex = p.parsePointcutExpression("args(String,Integer,Number)"); | |||
// if (LangUtil.is15VMOrGreater()) { | |||
// if (LangUtil.isVMGreaterOrEqual(15)) { | |||
// assertTrue("matches", ex.matchesMethodExecution(foo).alwaysMatches()); | |||
// } else { | |||
// assertTrue("Does not match", ex.matchesMethodExecution(foo).neverMatches()); |
@@ -26,13 +26,13 @@ public class AjcTest { | |||
private static boolean is1dot6VMOrGreater = true; | |||
private static boolean is1dot7VMOrGreater = true; | |||
private static boolean is1dot8VMOrGreater = true; | |||
private static boolean is9VMOrGreater = LangUtil.is9VMOrGreater(); | |||
private static boolean is10VMOrGreater = LangUtil.is10VMOrGreater(); | |||
private static boolean is11VMOrGreater = LangUtil.is11VMOrGreater(); | |||
private static boolean is12VMOrGreater = LangUtil.is12VMOrGreater(); | |||
private static boolean is13VMOrGreater = LangUtil.is13VMOrGreater(); | |||
private static boolean is14VMOrGreater = LangUtil.is14VMOrGreater(); | |||
private static boolean is15VMOrGreater = LangUtil.is15VMOrGreater(); | |||
private static boolean is9VMOrGreater = LangUtil.isVMGreaterOrEqual(9); | |||
private static boolean is10VMOrGreater = LangUtil.isVMGreaterOrEqual(10); | |||
private static boolean is11VMOrGreater = LangUtil.isVMGreaterOrEqual(11); | |||
private static boolean is12VMOrGreater = LangUtil.isVMGreaterOrEqual(12); | |||
private static boolean is13VMOrGreater = LangUtil.isVMGreaterOrEqual(13); | |||
private static boolean is14VMOrGreater = LangUtil.isVMGreaterOrEqual(14); | |||
private static boolean is15VMOrGreater = LangUtil.isVMGreaterOrEqual(15); | |||
private List<ITestStep> testSteps = new ArrayList<>(); | |||
@@ -25,8 +25,7 @@ import org.apache.tools.ant.Target; | |||
import org.apache.tools.ant.taskdefs.Java; | |||
import org.apache.tools.ant.types.Path; | |||
import org.aspectj.tools.ajc.AjcTestCase; | |||
import static org.aspectj.util.LangUtil.is16VMOrGreater; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
* Element that allow to run an abritrary Ant target in a sandbox. | |||
@@ -110,8 +109,14 @@ public class AntSpec implements ITestStep { | |||
// | |||
// Attention: Ant 1.6.3 under Linux neither likes "" (empty string) nor " " (space), on Windows it would not be | |||
// a problem. So we use "_dummy" Java system properties, even though they pollute the command line. | |||
p.setUserProperty("aj.addOpensKey", is16VMOrGreater() ? "--add-opens" : "-D_dummy"); | |||
p.setUserProperty("aj.addOpensValue", is16VMOrGreater() ? "java.base/java.lang=ALL-UNNAMED" : "-D_dummy"); | |||
p.setUserProperty( | |||
"aj.addOpensKey", | |||
LangUtil.isVMGreaterOrEqual(16) ? "--add-opens" : "-D_dummy" | |||
); | |||
p.setUserProperty( | |||
"aj.addOpensValue", | |||
LangUtil.isVMGreaterOrEqual(16) ? "java.base/java.lang=ALL-UNNAMED" : "-D_dummy" | |||
); | |||
// create the test implicit path aj.path that contains the sandbox + regular test infra path | |||
Path path = new Path(p, inTestCase.getSandboxDirectory().getAbsolutePath()); |
@@ -21,8 +21,7 @@ import java.util.StringTokenizer; | |||
import org.aspectj.tools.ajc.AjcTestCase; | |||
import org.aspectj.util.FileUtil; | |||
import static org.aspectj.util.LangUtil.is16VMOrGreater; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
* @author Adrian Colyer | |||
@@ -82,7 +81,7 @@ public class RunSpec implements ITestStep { | |||
// unwanted illegal access warnings during weaving in 'useFullLTW' mode, either making existing tests fail or | |||
// having to assert on the warning messages. | |||
// | |||
// vmargs += is16VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : ""; | |||
// vmargs += LangUtil.isVMGreaterOrEqual(16) ? " --add-opens java.base/java.lang=ALL-UNNAMED" : ""; | |||
AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw)); | |||
@@ -22,7 +22,7 @@ public abstract class XMLBasedAjcTestCaseForJava10OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is10VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(10)) | |||
throw new IllegalStateException("These tests should be run on Java 10 or later"); | |||
super.setUp(); | |||
} |
@@ -22,7 +22,7 @@ public abstract class XMLBasedAjcTestCaseForJava11OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is11VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(11)) | |||
throw new IllegalStateException("These tests should be run on Java 11 or later"); | |||
super.setUp(); | |||
} |
@@ -22,7 +22,7 @@ public abstract class XMLBasedAjcTestCaseForJava12OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is12VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(12)) | |||
throw new IllegalStateException("These tests should be run on Java 12 or later"); | |||
super.setUp(); | |||
} |
@@ -22,7 +22,7 @@ public abstract class XMLBasedAjcTestCaseForJava13OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is13VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(13)) | |||
throw new IllegalStateException("These tests should be run on Java 13 or later"); | |||
super.setUp(); | |||
} |
@@ -25,7 +25,7 @@ public abstract class XMLBasedAjcTestCaseForJava14Only extends XMLBasedAjcTestCa | |||
); | |||
// Activate this block before upgrading to JDT Core Java 15 | |||
/* | |||
if (!LangUtil.is14VMOrGreater() || LangUtil.is15VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(14) || LangUtil.isVMGreaterOrEqual(15)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 14 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava14OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is14VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(14)) | |||
throw new IllegalStateException("These tests should be run on Java 14 or later"); | |||
super.setUp(); | |||
} |
@@ -25,7 +25,7 @@ public abstract class XMLBasedAjcTestCaseForJava15Only extends XMLBasedAjcTestCa | |||
); | |||
// Activate this block before upgrading to JDT Core Java 16 | |||
/* | |||
if (!LangUtil.is15VMOrGreater() || LangUtil.is16VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(15) || LangUtil.isVMGreaterOrEqual(16)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 15 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava15OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is15VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(15)) | |||
throw new IllegalStateException("These tests should be run on Java 15 or later"); | |||
super.setUp(); | |||
} |
@@ -27,7 +27,7 @@ public abstract class XMLBasedAjcTestCaseForJava16Only extends XMLBasedAjcTestCa | |||
); | |||
// Activate this block before upgrading to JDT Core Java 17 | |||
/* | |||
if (!LangUtil.is16VMOrGreater() || LangUtil.is17VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(16) || LangUtil.isVMGreaterOrEqual(17)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 16 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava16OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is16VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(16)) | |||
throw new IllegalStateException("These tests should be run on Java 16 or later"); | |||
super.setUp(); | |||
} |
@@ -27,7 +27,7 @@ public abstract class XMLBasedAjcTestCaseForJava17Only extends XMLBasedAjcTestCa | |||
); | |||
// Activate this block before upgrading to JDT Core Java 18 | |||
/* | |||
if (!LangUtil.is17VMOrGreater() || LangUtil.is18VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(17) || LangUtil.isVMGreaterOrEqual(18)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 17 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava17OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is17VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(17)) | |||
throw new IllegalStateException("These tests should be run on Java 17 or later"); | |||
super.setUp(); | |||
} |
@@ -27,7 +27,7 @@ public abstract class XMLBasedAjcTestCaseForJava18Only extends XMLBasedAjcTestCa | |||
); | |||
// Activate this block before upgrading to JDT Core Java 19 | |||
/* | |||
if (!LangUtil.is18VMOrGreater() || LangUtil.is19VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(18) || LangUtil.isVMGreaterOrEqual(19)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 18 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava18OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is18VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(18)) | |||
throw new IllegalStateException("These tests should be run on Java 18 or later"); | |||
super.setUp(); | |||
} |
@@ -27,7 +27,7 @@ public abstract class XMLBasedAjcTestCaseForJava19Only extends XMLBasedAjcTestCa | |||
); | |||
// Activate this block before upgrading to JDT Core Java 20 | |||
/* | |||
if (!LangUtil.is19VMOrGreater() || LangUtil.is20VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(19) || LangUtil.isVMGreaterOrEqual(20)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 19 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava19OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is19VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(19)) | |||
throw new IllegalStateException("These tests should be run on Java 19 or later"); | |||
super.setUp(); | |||
} |
@@ -27,7 +27,7 @@ public abstract class XMLBasedAjcTestCaseForJava20Only extends XMLBasedAjcTestCa | |||
); | |||
// Activate this block before upgrading to JDT Core Java 21 | |||
/* | |||
if (!LangUtil.is20VMOrGreater() || LangUtil.is21VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(20) || LangUtil.isVMGreaterOrEqual(21)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 20 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava20OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is20VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(20)) | |||
throw new IllegalStateException("These tests should be run on Java 20 or later"); | |||
super.setUp(); | |||
} |
@@ -30,7 +30,7 @@ public abstract class XMLBasedAjcTestCaseForJava21Only extends XMLBasedAjcTestCa | |||
*/ | |||
// AspectJ_JDK_Update | |||
// Activate this block before upgrading to JDT Core Java 22 | |||
if (!LangUtil.is21VMOrGreater() || LangUtil.is22VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(21) || LangUtil.isVMGreaterOrEqual(22)) { | |||
throw new IllegalStateException( | |||
"These tests should be run on Java 21 only " + | |||
"(e.g. because they use version-specific preview features)" |
@@ -19,7 +19,7 @@ public abstract class XMLBasedAjcTestCaseForJava21OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is21VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(21)) | |||
throw new IllegalStateException("These tests should be run on Java 21 or later"); | |||
super.setUp(); | |||
} |
@@ -22,7 +22,7 @@ public abstract class XMLBasedAjcTestCaseForJava9OrLater extends XMLBasedAjcTest | |||
@Override | |||
public void setUp() throws Exception { | |||
if (!LangUtil.is9VMOrGreater()) | |||
if (!LangUtil.isVMGreaterOrEqual(9)) | |||
throw new IllegalStateException("These tests should be run on Java 9 or later"); | |||
super.setUp(); | |||
} |
@@ -48,7 +48,7 @@ public class AjcTaskCompileCommandTest extends TestCase { | |||
list.add("-classpath"); | |||
StringBuilder classpath = new StringBuilder(); | |||
classpath.append(Globals.F_aspectjrt_jar.getAbsolutePath()); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
classpath.append(File.pathSeparator).append(LangUtil.getJrtFsFilePath()); | |||
} | |||
list.add(classpath.toString()); |
@@ -783,7 +783,7 @@ public class GenericsTests extends XMLBasedAjcTestCase { | |||
} | |||
public void testAfterReturningWithWildcardVar() { | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
// See ReferenceType.isCoerceableFrom comments | |||
return; | |||
} |
@@ -18,8 +18,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.util.FileUtil; | |||
import junit.framework.Test; | |||
import static org.aspectj.util.LangUtil.is16VMOrGreater; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||
@@ -143,7 +142,7 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase { | |||
// | |||
// TODO: A better solution would be a recursive filtered search via Files.walk, ideally added as a recursive search | |||
// option for CountingFilenameFilter. | |||
String proxyDir = is16VMOrGreater() ? "jdk/proxy1" : "com/sun/proxy"; | |||
String proxyDir = LangUtil.isVMGreaterOrEqual(16) ? "jdk/proxy1" : "com/sun/proxy"; | |||
File f = new File(dir, "_ajdump/_before/" + proxyDir); | |||
CountingFilenameFilter cff = new CountingFilenameFilter(".class"); |
@@ -69,7 +69,7 @@ public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
// This tests that when using --add-modules with one of the JDK modules (in the jmods subfolder of the JDK) | |||
// that it can be found without needing to set --module-path (this seems to be implicitly included by javac too) | |||
public void testAddModules1() { | |||
if (LangUtil.is11VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
// java.xml.bind is gone in Java11 | |||
return; | |||
} | |||
@@ -79,7 +79,7 @@ public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
// This tests that we can use add-modules to pull in something from the JDK jmods package and that | |||
// when subsequently weaving we can see types from those modules | |||
public void testWovenAfterAddModules() { | |||
if (LangUtil.is11VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
// java.xml.bind is gone in Java11 | |||
return; | |||
} | |||
@@ -88,7 +88,7 @@ public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
// --limit-modules | |||
public void testLimitModules1() { | |||
if (LangUtil.is11VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
// java.xml.bind is gone in Java11 | |||
return; | |||
} | |||
@@ -97,7 +97,7 @@ public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
// --add-reads | |||
public void testAddReads1() { | |||
if (LangUtil.is11VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
// java.xml.bind is gone in Java11 | |||
return; | |||
} |
@@ -19,13 +19,13 @@ public class AllTestsAspectJ1919 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.19 tests"); | |||
suite.addTest(Bugs1919Tests.suite()); | |||
if (LangUtil.is19VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(19)) { | |||
suite.addTest(SanityTestsJava19.suite()); | |||
suite.addTest(Ajc1919TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.is19VMOrGreater() && !LangUtil.is20VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(19) && !LangUtil.isVMGreaterOrEqual(20)) { | |||
suite.addTest(Java19PreviewFeaturesTests.suite()); | |||
} | |||
*/ |
@@ -19,13 +19,13 @@ public class AllTestsAspectJ1920 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.20 tests"); | |||
suite.addTest(Bugs1920Tests.suite()); | |||
if (LangUtil.is20VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(20)) { | |||
suite.addTest(SanityTestsJava20.suite()); | |||
suite.addTest(Ajc1920TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.is20VMOrGreater() && !LangUtil.is21VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(20) && !LangUtil.isVMGreaterOrEqual(21)) { | |||
suite.addTest(Java20PreviewFeaturesTests.suite()); | |||
} | |||
*/ |
@@ -31,14 +31,14 @@ public class AllTestsAspectJ1921 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.21 tests"); | |||
suite.addTest(Bugs1921Tests.suite()); | |||
if (LangUtil.is21VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(21)) { | |||
suite.addTest(SanityTestsJava21.suite()); | |||
suite.addTest(Ajc1921TestsJava.suite()); | |||
} | |||
// AspectJ_JDK_Update | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
// TODO: Comment out the following block when upgrading JDT Core to Java 22 | |||
if (LangUtil.is21VMOrGreater() && !LangUtil.is22VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(21) && !LangUtil.isVMGreaterOrEqual(22)) { | |||
suite.addTest(Java21PreviewFeaturesTests.suite()); | |||
} | |||
return suite; |
@@ -20,7 +20,7 @@ public class AllTestsAspectJ195 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.5 tests"); | |||
suite.addTest(Ajc195Tests.suite()); | |||
if (LangUtil.is13VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(13)) { | |||
suite.addTest(SanityTestsJava13.suite()); | |||
} | |||
return suite; |
@@ -19,13 +19,13 @@ public class AllTestsAspectJ196 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.6 tests"); | |||
if (LangUtil.is14VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(14)) { | |||
suite.addTest(Ajc196Tests.suite()); | |||
suite.addTest(SanityTestsJava14.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.is14VMOrGreater() && !LangUtil.is15VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(14) && !LangUtil.isVMGreaterOrEqual(15)) { | |||
suite.addTest(Java14PreviewFeaturesTests.suite()); | |||
} | |||
*/ |
@@ -18,16 +18,16 @@ public class AllTestsAspectJ197 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.7 tests"); | |||
if (LangUtil.is15VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(15)) { | |||
suite.addTest(SanityTestsJava15.suite()); | |||
} | |||
if (LangUtil.is16VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(16)) { | |||
suite.addTest(SanityTestsJava16.suite()); | |||
suite.addTest(Ajc197TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.is16VMOrGreater() && !LangUtil.is17VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(16) && !LangUtil.isVMGreaterOrEqual(17)) { | |||
suite.addTest(Java16PreviewFeaturesTests.suite()); | |||
} | |||
*/ |
@@ -19,19 +19,19 @@ public class AllTestsAspectJ198 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.8 tests"); | |||
suite.addTest(Bugs198Tests.suite()); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
suite.addTest(CompileWithReleaseTests.suite()); | |||
} | |||
if (LangUtil.is11VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
suite.addTest(Bugs198Java11Tests.suite()); | |||
} | |||
if (LangUtil.is17VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(17)) { | |||
suite.addTest(SanityTestsJava17.suite()); | |||
suite.addTest(Ajc198TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.is17VMOrGreater() && !LangUtil.is18VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(17) && !LangUtil.isVMGreaterOrEqual(18)) { | |||
suite.addTest(Java17PreviewFeaturesTests.suite()); | |||
} | |||
*/ |
@@ -19,13 +19,13 @@ public class AllTestsAspectJ199 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.9 tests"); | |||
suite.addTest(Bugs199Tests.suite()); | |||
if (LangUtil.is18VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(18)) { | |||
suite.addTest(SanityTestsJava18.suite()); | |||
suite.addTest(Ajc199TestsJava.suite()); | |||
} | |||
// Do not run tests using a previous compiler's preview features anymore. They would all fail. | |||
/* | |||
if (LangUtil.is18VMOrGreater() && !LangUtil.is19VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(18) && !LangUtil.isVMGreaterOrEqual(19)) { | |||
suite.addTest(Java18PreviewFeaturesTests.suite()); | |||
} | |||
*/ |
@@ -23,7 +23,7 @@ import junit.framework.Test; | |||
public class AptTests extends XMLBasedAjcTestCase { | |||
public void testAptWithSpecifiedProcessor() { | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
return; | |||
} | |||
runTest("annotation processing with specified processor"); | |||
@@ -33,14 +33,14 @@ public class AptTests extends XMLBasedAjcTestCase { | |||
* SPI - https://docs.oracle.com/javase/tutorial/sound/SPI-intro.html | |||
*/ | |||
public void testAptUsingSPI() { | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
return; | |||
} | |||
runTest("annotation processing in action using SPI"); | |||
} | |||
public void testDisabledApt() { | |||
if (LangUtil.is11VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
// javax.annotation.Generated not in Java11 | |||
return; | |||
} |
@@ -76,7 +76,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio | |||
+ "../lib/junit/junit.jar" + File.pathSeparator | |||
+ ".." + File.separator + "lib" + File.separator + "test" + File.separator + "aspectjrt.jar"; | |||
verifyClasspath(cp); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
cp = LangUtil.getJrtFsFilePath() + File.pathSeparator + cp; | |||
} | |||
@@ -26,7 +26,7 @@ public class TestsModuleTests extends TestCase { | |||
String name = TestsModuleTests.class.getName(); | |||
TestSuite suite = new TestSuite(name); | |||
// compiler tests, wrapped for JUnit | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
suite.addTest(AllTests19.suite()); | |||
} else { | |||
suite.addTest(AllTests18.suite()); |
@@ -110,90 +110,12 @@ public class LangUtil { | |||
return result; | |||
} | |||
@Deprecated | |||
public static boolean is1dot3VMOrGreater() { | |||
return 1.3 <= vmVersion; | |||
public static boolean isVMGreaterOrEqual(int javaVersion) { | |||
return isVMGreaterOrEqual((double) javaVersion); | |||
} | |||
@Deprecated | |||
public static boolean is1dot4VMOrGreater() { | |||
return 1.4 <= vmVersion; | |||
} | |||
@Deprecated | |||
public static boolean is1dot5VMOrGreater() { | |||
return 1.5 <= vmVersion; | |||
} | |||
@Deprecated | |||
public static boolean is1dot6VMOrGreater() { | |||
return 1.6 <= vmVersion; | |||
} | |||
@Deprecated | |||
public static boolean is1dot7VMOrGreater() { | |||
return 1.7 <= vmVersion; | |||
} | |||
public static boolean is1dot8VMOrGreater() { | |||
return 1.8 <= vmVersion; | |||
} | |||
public static boolean is9VMOrGreater() { | |||
return 9 <= vmVersion; | |||
} | |||
public static boolean is10VMOrGreater() { | |||
return 10 <= vmVersion; | |||
} | |||
public static boolean is11VMOrGreater() { | |||
return 11 <= vmVersion; | |||
} | |||
public static boolean is12VMOrGreater() { | |||
return 12 <= vmVersion; | |||
} | |||
public static boolean is13VMOrGreater() { | |||
return 13 <= vmVersion; | |||
} | |||
public static boolean is14VMOrGreater() { | |||
return 14 <= vmVersion; | |||
} | |||
public static boolean is15VMOrGreater() { | |||
return 15 <= vmVersion; | |||
} | |||
public static boolean is16VMOrGreater() { | |||
return 16 <= vmVersion; | |||
} | |||
public static boolean is17VMOrGreater() { | |||
return 17 <= vmVersion; | |||
} | |||
public static boolean is18VMOrGreater() { | |||
return 18 <= vmVersion; | |||
} | |||
public static boolean is19VMOrGreater() { | |||
return 19 <= vmVersion; | |||
} | |||
public static boolean is20VMOrGreater() { | |||
return 20 <= vmVersion; | |||
} | |||
public static boolean is21VMOrGreater() { | |||
return 21 <= vmVersion; | |||
} | |||
// AspectJ_JDK_Update | |||
public static boolean is22VMOrGreater() { | |||
return 22 <= vmVersion; | |||
public static boolean isVMGreaterOrEqual(double javaVersion) { | |||
return javaVersion <= vmVersion; | |||
} | |||
/** |
@@ -101,10 +101,10 @@ public class LangUtilTest extends TestCase { | |||
// } | |||
public void testVersion() { | |||
assertTrue(LangUtil.is1dot8VMOrGreater()); // min vm now - floor may change | |||
if (LangUtil.is11VMOrGreater()) { | |||
assertTrue(LangUtil.is9VMOrGreater()); | |||
assertTrue(LangUtil.is10VMOrGreater()); | |||
assertTrue(LangUtil.isVMGreaterOrEqual(1.8)); // min vm now - floor may change | |||
if (LangUtil.isVMGreaterOrEqual(11)) { | |||
assertTrue(LangUtil.isVMGreaterOrEqual(9)); | |||
assertTrue(LangUtil.isVMGreaterOrEqual(10)); | |||
} | |||
} | |||
@@ -351,7 +351,7 @@ public class ClassPathManager { | |||
String jdkHome = new File(jrtFsPath).getParentFile().getParent(); | |||
FileSystem fs = null; | |||
try { | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
Map<String, String> env = new HashMap<>(); | |||
env.put("java.home", jdkHome); | |||
fs = FileSystems.newFileSystem(JRT_URI, env); |
@@ -149,7 +149,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
} | |||
// On Java9 it is possible to fail to find a URLClassLoader from which to derive a suitable classpath | |||
// For now we can determine it from the java.class.path: | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
list.add(0, LangUtil.getJrtFsFilePath()); | |||
List<String> javaClassPathEntries = makeClasspath(System.getProperty("java.class.path")); | |||
for (int i=javaClassPathEntries.size()-1;i>=0;i--) { |
@@ -110,7 +110,7 @@ public class WeaverModuleTests extends TestCase { | |||
suite.addTestSuite(FieldSetTestCase.class); | |||
suite.addTestSuite(HierarchyDependsTestCase.class); | |||
suite.addTestSuite(IdWeaveTestCase.class); | |||
if (LangUtil.is9VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(9)) { | |||
suite.addTestSuite(JImageTestCase.class); | |||
} | |||
suite.addTestSuite(MegaZipTestCase.class); |
@@ -48,13 +48,13 @@ public class BcelGenericSignatureToTypeXTestCase extends TestCase { | |||
cSig.formalTypeParameters, world); | |||
assertEquals("Ljava/lang/Object;", superclass.getSignature()); | |||
System.out.println(Arrays.toString(cSig.superInterfaceSignatures)); | |||
if (LangUtil.is12VMOrGreater()) { | |||
if (LangUtil.isVMGreaterOrEqual(12)) { | |||
// [Ljava/lang/constant/Constable;, Ljava/lang/Comparable<TE;>;, Ljava/io/Serializable;] | |||
assertEquals("3 superinterfaces but "+Arrays.toString(cSig.superInterfaceSignatures), 3, cSig.superInterfaceSignatures.length); | |||
} else { | |||
assertEquals("2 superinterfaces", 2, cSig.superInterfaceSignatures.length); | |||
} | |||
int idx = LangUtil.is12VMOrGreater()?1:0; | |||
int idx = LangUtil.isVMGreaterOrEqual(12)?1:0; | |||
UnresolvedType comparable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[idx++], | |||
cSig.formalTypeParameters, world); | |||
assertEquals("Pjava/lang/Comparable<TE;>;", comparable.getSignature()); |
@@ -49,13 +49,13 @@ public class JImageTestCase extends TestCase { | |||
} | |||
public void testOnJava9() { | |||
if (!LangUtil.is9VMOrGreater()) { | |||
if (!LangUtil.isVMGreaterOrEqual(9)) { | |||
System.out.println("SKIPPING JIMAGE TESTS AS NOT ON 1.9 OR LATER"); | |||
} | |||
} | |||
public void testBasicStructureAndCapabilities() { | |||
if (!LangUtil.is9VMOrGreater()) return; | |||
if (!LangUtil.isVMGreaterOrEqual(9)) return; | |||
// Should be one entry for finding JRT contents | |||
List<Entry> entries = cpm.getEntries(); | |||
assertEquals(1,entries.size()); | |||
@@ -67,7 +67,7 @@ public class JImageTestCase extends TestCase { | |||
} | |||
public void testBehaviour() throws Exception { | |||
if (!LangUtil.is9VMOrGreater()) return; | |||
if (!LangUtil.isVMGreaterOrEqual(9)) return; | |||
JImageEntry jie = getJImageEntry(); | |||
Map<String, Path> packageCache = jie.getPackageCache(); |