diff options
61 files changed, 117 insertions, 192 deletions
diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java index 2cee23cc6..c7a63b5ba 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java @@ -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")); diff --git a/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestCompilerConfiguration.java b/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestCompilerConfiguration.java index 68ecee15d..53bd632af 100644 --- a/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestCompilerConfiguration.java +++ b/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestCompilerConfiguration.java @@ -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; diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java index 8e2432092..eeacafe0d 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java @@ -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 = ""; diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java index c44fdb50d..c435cfdae 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java @@ -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); diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java index dd90652cb..f9f348906 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java @@ -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(); diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java index e9ce22822..7cb259f9b 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java @@ -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()); diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java index 412d2d4eb..c3e076b89 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java @@ -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>", diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java index ab132ed46..1755b55a7 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java @@ -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 " + diff --git a/bridge/src/test/java/org/aspectj/bridge/VersionTest.java b/bridge/src/test/java/org/aspectj/bridge/VersionTest.java index ecf3b230b..dfef15595 100644 --- a/bridge/src/test/java/org/aspectj/bridge/VersionTest.java +++ b/bridge/src/test/java/org/aspectj/bridge/VersionTest.java @@ -45,7 +45,7 @@ public class VersionTest extends TestCase { } public void testVersion() { - if (LangUtil.is11VMOrGreater()) { + if (LangUtil.isVMGreaterOrEqual(11)) { return; } if (Version.getTimeText().equals("")) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java index 202abcadd..8548ce51e 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java @@ -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); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java index e259bf6d3..794ee351c 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java @@ -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()); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 6fb2d2602..11b90c3b7 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java @@ -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(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java index 71a229388..972068ce2 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java @@ -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 = diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonAdvancedPointcutExpressionTests.java b/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonAdvancedPointcutExpressionTests.java index 1411d430b..cc61d7c75 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonAdvancedPointcutExpressionTests.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonAdvancedPointcutExpressionTests.java @@ -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()); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java b/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java index 29d12850d..6ffea73a8 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java @@ -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()); diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java index 5ae803205..8686e87b9 100644 --- a/testing/src/test/java/org/aspectj/testing/AjcTest.java +++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java @@ -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<>(); diff --git a/testing/src/test/java/org/aspectj/testing/AntSpec.java b/testing/src/test/java/org/aspectj/testing/AntSpec.java index 33668d509..927749657 100644 --- a/testing/src/test/java/org/aspectj/testing/AntSpec.java +++ b/testing/src/test/java/org/aspectj/testing/AntSpec.java @@ -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()); diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java index 4d7526f44..259f675d8 100644 --- a/testing/src/test/java/org/aspectj/testing/RunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java @@ -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)); diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java index cde3c077e..c7d67e4ab 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java index 2083f462e..08f0e0d78 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java index 86da7d4a4..fdd94de51 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java index a280f157f..635785c20 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java index 70ebef477..e4c864049 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java index d147c572f..7f6b7c7d3 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java index 5b64445a9..dd6ef21e5 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java index 3027825a2..ad5f3e108 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java index 115e01289..794d5276d 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java index 7f5da29b0..3a763af47 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java index 78941fcab..eeb681b6d 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java index 1e18e2f7a..bb32898b1 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java index fade6c92f..21c1dce4f 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java index 20e26862f..65fcc325e 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java index 36b642c30..e931bc3f9 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java index 95beffef5..e33862f32 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java index 4e0567d0d..43b50a6bc 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java index 352136529..1289d9672 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java index 2c582c106..3014e1a96 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java @@ -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)" diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java index 4c1d59d15..11fc3ba7f 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java index 5a8ae0b01..d5decf8b9 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java @@ -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(); } diff --git a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java index 94ed0767d..70dfffbb8 100644 --- a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java +++ b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java @@ -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()); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java index ae44e9a60..ac432a706 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java @@ -783,7 +783,7 @@ public class GenericsTests extends XMLBasedAjcTestCase { } public void testAfterReturningWithWildcardVar() { - if (LangUtil.is9VMOrGreater()) { + if (LangUtil.isVMGreaterOrEqual(9)) { // See ReferenceType.isCoerceableFrom comments return; } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java index c7be1944c..fbc6cdca0 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java @@ -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"); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java index 70adf5667..a73c75077 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java @@ -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; } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java index e7b67db7b..22e7b6184 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java @@ -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()); } */ diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java index a095eb758..ae80c49bc 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java @@ -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()); } */ diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java b/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java index 30b6728f1..56e8b963a 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java @@ -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; 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 e84b6ee4f..092160565 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java @@ -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; diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java index d3cbfb9ab..8e19afc14 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java @@ -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()); } */ diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java index fe767e639..7feccc2e2 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java @@ -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()); } */ diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java index 929b5749d..8e84af9fd 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java @@ -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()); } */ diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java index 6b77073be..724fcdf62 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java @@ -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()); } */ diff --git a/tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java b/tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java index 24bc32dd1..62dac6e6e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java @@ -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; } diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java index 52602114e..7f15341e9 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -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; } diff --git a/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java index cf07bfd9d..993b457f8 100644 --- a/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java +++ b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java @@ -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()); diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java index 9db8f629b..baf8d440e 100644 --- a/util/src/main/java/org/aspectj/util/LangUtil.java +++ b/util/src/main/java/org/aspectj/util/LangUtil.java @@ -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; } /** diff --git a/util/src/test/java/org/aspectj/util/LangUtilTest.java b/util/src/test/java/org/aspectj/util/LangUtilTest.java index 0ac3e846e..7bd898e9b 100644 --- a/util/src/test/java/org/aspectj/util/LangUtilTest.java +++ b/util/src/test/java/org/aspectj/util/LangUtilTest.java @@ -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)); } } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java index c76e91956..bfef435ec 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java @@ -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); diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java index 1617cb22b..9ee4c0962 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java @@ -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--) { diff --git a/weaver/src/test/java/org/aspectj/weaver/WeaverModuleTests.java b/weaver/src/test/java/org/aspectj/weaver/WeaverModuleTests.java index ef1a1f2f9..5f36e7e80 100644 --- a/weaver/src/test/java/org/aspectj/weaver/WeaverModuleTests.java +++ b/weaver/src/test/java/org/aspectj/weaver/WeaverModuleTests.java @@ -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); diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java index 3ab35167c..bbe5e1892 100644 --- a/weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java @@ -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()); diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java index 1ca86c371..c6656fcff 100644 --- a/weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java @@ -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(); |