]> source.dussan.org Git - aspectj.git/commitdiff
LangUtil: remove methods like 'is11VMOrGreater', 'is1dot5VMOrGreater'
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 19 Feb 2024 03:22:10 +0000 (10:22 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 19 Feb 2024 04:21:19 +0000 (11:21 +0700)
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>
61 files changed:
ajde.core/src/test/java/org/aspectj/ajde/core/TestCompilerConfiguration.java
ajde/src/test/java/org/aspectj/ajde/ui/utils/TestCompilerConfiguration.java
ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java
ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java
ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java
ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java
ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java
bridge/src/test/java/org/aspectj/bridge/VersionTest.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java
org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java
org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java
org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonAdvancedPointcutExpressionTests.java
org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java
testing/src/test/java/org/aspectj/testing/AjcTest.java
testing/src/test/java/org/aspectj/testing/AntSpec.java
testing/src/test/java/org/aspectj/testing/RunSpec.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava19OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava20OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21Only.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava21OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java
testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java
tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java
tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java
tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java
tests/src/test/java/org/aspectj/systemtest/ajc1920/AllTestsAspectJ1920.java
tests/src/test/java/org/aspectj/systemtest/ajc1921/AllTestsAspectJ1921.java
tests/src/test/java/org/aspectj/systemtest/ajc195/AllTestsAspectJ195.java
tests/src/test/java/org/aspectj/systemtest/ajc196/AllTestsAspectJ196.java
tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java
tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java
tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java
tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java
tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java
tests/src/test/java/org/aspectj/tests/TestsModuleTests.java
util/src/main/java/org/aspectj/util/LangUtil.java
util/src/test/java/org/aspectj/util/LangUtilTest.java
weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java
weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java
weaver/src/test/java/org/aspectj/weaver/WeaverModuleTests.java
weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java
weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java

index 2cee23cc61c3edb33b21d8df20c6aaa792c33d70..c7a63b5ba11874edf076d5dd64b500e1b1767c61 100644 (file)
@@ -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"));
index 68ecee15d29d81a9b6cb188803fb11f44fec5ef3..53bd632af7247fd4f7d6d127507ae40bd82dadde 100644 (file)
@@ -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;
index 8e24320920811f9329737b87c5db0c13a5d2319a..eeacafe0de8386c7270e1185da5c6209f88216b3 100644 (file)
@@ -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 = "";
index c44fdb50d5ecb923ecd4795810aab34382a64ecd..c435cfdaea3d856645f860e79543291171614a05 100644 (file)
@@ -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);
index dd90652cb1c00e70e1545fa154aa8adc5bd7a260..f9f3489065a1477b9b941fbb30c366e694d8948e 100644 (file)
@@ -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();
index e9ce2282215090ab7591dba199a63ceaffc4529f..7cb259f9b0a48f8cb1f5e250cffcbdeae330ba6e 100644 (file)
@@ -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());
index 412d2d4eb5d28acc5302cff503b3d320016af1c3..c3e076b892e4534c6f74db3c2f94078f295a85e8 100644 (file)
@@ -319,7 +319,7 @@ public class CoverageTestCase extends AjdocTestCase {
                }
 
                String[] strings = {
-                               LangUtil.is11VMOrGreater()?"&lt;init&gt;()":toName("Point()"),
+                               LangUtil.isVMGreaterOrEqual(11)?"&lt;init&gt;()":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()?"&lt;init&gt;()":toName("Point()"),
+                               LangUtil.isVMGreaterOrEqual(11)?"&lt;init&gt;()":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()?"&lt;init&gt;()":toName("Point()"),
+                               LangUtil.isVMGreaterOrEqual(11)?"&lt;init&gt;()":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>",
index ab132ed46d9c7515d97d975be6160f67e7cb29c6..1755b55a75778c0b77ceffd656500253b96cdb06 100644 (file)
@@ -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()?"&lt;init&gt;(java.lang.String)":toName("C(java.lang.String)"),
+                               LangUtil.isVMGreaterOrEqual(11)?"&lt;init&gt;(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 " +
index ecf3b230b937c3a6e0ae9448fb4a22a87049f41b..dfef155958e103d894c77852da7fc9512a3c5d98 100644 (file)
@@ -45,7 +45,7 @@ public class VersionTest extends TestCase {
        }
 
        public void testVersion() {
-               if (LangUtil.is11VMOrGreater()) {
+               if (LangUtil.isVMGreaterOrEqual(11)) {
                        return;
                }
                if (Version.getTimeText().equals("")) {
index 202abcadd186e5437ff0a52faf9b58a244bf8845..8548ce51e1f3307945508a2e6cb91f0789690ec3 100644 (file)
@@ -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);
index e259bf6d3cf816a8cca0de1636c4071883a0f3e0..794ee351c6c309340d2a46581ad1c79138f3708a 100644 (file)
@@ -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());
index 6fb2d260269bdf8ab656feecbc619e5aa5ebcceb..11b90c3b730ce6833c96118983bcc6b5bc367393 100644 (file)
@@ -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();
index 71a22938839815b4bfafb33d8c6a99846d9242f1..972068ce2ec8fe7bd33b3be3eddecbf0a0c7b024 100644 (file)
@@ -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 =
index 1411d430ba77937a76050e882d3321b84e731b17..cc61d7c75a532f4b93e75e9ae3f7388ff14bc152 100644 (file)
@@ -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());
index 29d12850d853b9fd2ddf29e5b60cccdffba13355..6ffea73a8671a4508526908dae44c39487cda1c7 100644 (file)
@@ -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());
index 5ae803205b4f0e22e07143409575e4e2bd465bda..8686e87b930f9dc4dba94f2126cf3308f71ebfb1 100644 (file)
@@ -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<>();
 
index 33668d509bc1ed81e9088569a061ba17162e0b6e..9277496572095cc326da416ac504b1caf35cc453 100644 (file)
@@ -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());
index 4d7526f44aac511fde078b86e2be54c5d68469be..259f675d86e961fab99fd131f8cc1b1d6bd52f57 100644 (file)
@@ -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));
 
index cde3c077e57bcb4c6b86be6c9d5838d9e0eef3d2..c7d67e4abce67eb8905e1b936e0fce353a19b78b 100644 (file)
@@ -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();
        }
index 2083f462e33577900086d1c519b686e00dcaaeda..08f0e0d78e61526787fad5eba5e680df1b9a74e8 100644 (file)
@@ -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();
        }
index 86da7d4a48de94d9940e48ccf7d5dbf6a04a66ce..fdd94de51e32efabf10f96ccf8f4a78f41db246a 100644 (file)
@@ -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();
        }
index a280f157f6805565cdd618ac332dea7ace62335e..635785c20abc53abb731f0d67e48af37f81d717b 100644 (file)
@@ -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();
        }
index 70ebef47738d5c6f3eb68ba1133d086f39dda64d..e4c864049256127e022af293c9518c7b8d158605 100644 (file)
@@ -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)"
index d147c572f216c06a27d91cfa46eba98eb14937d6..7f6b7c7d3ecde19b31daa728df46bf9c20be3f4c 100644 (file)
@@ -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();
        }
index 5b64445a90b2295f0a9796e77a6639a4e139a227..dd6ef21e5813fee56df46550f8e72b848abe2067 100644 (file)
@@ -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)"
index 3027825a2be8a83af5edb40222eafbbfe78d8974..ad5f3e1089ee6110f2e5a536b6bd171fe0a818de 100644 (file)
@@ -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();
        }
index 115e01289b7284e4ed44686f9073829a30fa0cbd..794d5276d92b0e40d381114f0fab7d766f73c200 100644 (file)
@@ -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)"
index 7f5da29b0ddae65e70b790a04e68cc71db2b5467..3a763af472b17bf7992a287fc9f220a2a643ef40 100644 (file)
@@ -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();
        }
index 78941fcabbab7ef6f52a048b3b318f163d736b25..eeb681b6d38946360319a709d3b6c68a88d6ae09 100644 (file)
@@ -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)"
index 1e18e2f7a6e3ad0c7c608458333e5062e8316f8e..bb32898b1ec098e4bed7ca71730ef88f5527ad41 100644 (file)
@@ -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();
        }
index fade6c92fee27207a8c07ce68b6e7cf19cf6067f..21c1dce4f7a7de270a19b31d75a6aeea48e4870a 100644 (file)
@@ -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)"
index 20e26862f8dc9dc0def5ab0630133e873cbc5f38..65fcc325e2778146d318f8bbfadfb9df0562793d 100644 (file)
@@ -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();
        }
index 36b642c30bf724cdbb1599d3922025d73f3b8af6..e931bc3f942086b17925b401e8bcf14094cbf1d5 100644 (file)
@@ -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)"
index 95beffef5385c4915c57d0b2258230ef3f5c975f..e33862f327c70abc6569626f17b4a634e667abeb 100644 (file)
@@ -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();
        }
index 4e0567d0dfa00fde929b725b0d85f568a65647e3..43b50a6bc81eecf5fc8b173a17035bff5205636f 100644 (file)
@@ -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)"
index 352136529e1c0a9eb615a0b1b1ebb673656142e5..1289d9672f9ddce18d1253021c7492126ecb8b1f 100644 (file)
@@ -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();
        }
index 2c582c1068ba7b625427794bf68ac393ebef50c4..3014e1a96e815f3a4427fae6cdb6eb8437cbd0b3 100644 (file)
@@ -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)"
index 4c1d59d15aad5feb88b73220000f66b0fa217fe6..11fc3ba7f59b120843c24daa2289f75562f07b40 100644 (file)
@@ -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();
        }
index 5a8ae0b012d087d154d56f9bb914fc97eae1cd80..d5decf8b9451fa39dedb342dfd4ab0dad622bf2d 100644 (file)
@@ -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();
        }
index 94ed0767d8800c64cbb017ca43e0a656642aa4ff..70dfffbb8ede5b9b63d02a0f17684934754f8afc 100644 (file)
@@ -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());
index ae44e9a600eaf59e48db5f461dfb984d2fae2a7a..ac432a7064e4ba2ab14a443f170c916c970d4ffe 100644 (file)
@@ -783,7 +783,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
        }
 
        public void testAfterReturningWithWildcardVar() {
-               if (LangUtil.is9VMOrGreater()) {
+               if (LangUtil.isVMGreaterOrEqual(9)) {
                        // See ReferenceType.isCoerceableFrom comments
                        return;
                }
index c7be1944c535d40ef5226a48ecdbeb336aaee3f4..fbc6cdca0132b5f0e09dd3aac8ef8e31aa61b1ea 100644 (file)
@@ -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");
index 70adf5667d1a7f529f0376fd9fbb689dfe08c2ad..a73c75077882761cd192c01f8ba7795404bd68b7 100644 (file)
@@ -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;
                }
index e7b67db7b246b10cd04a6b6169983b9bc27bc461..22e7b6184d848be1d225a916b773816ee8bc5b43 100644 (file)
@@ -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());
                }
                */
index a095eb7585b93f122422b31f31b4b1ecdfb7a02e..ae80c49bc3798c8c226dac4fde8223915d630859 100644 (file)
@@ -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());
                }
                */
index 30b6728f1769b5d1775a5bc80b0350f8a75a3a30..56e8b963a7e62c2a662cc328c8a619d7333f4e4c 100644 (file)
@@ -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;
index e84b6ee4f11770473ffa6c56400687774381e5e2..092160565d52041cfbcb9a5fee649389e502ca23 100644 (file)
@@ -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;
index d3cbfb9ab9400c8d8c7f8be1d2a3bbdfd7ad0040..8e19afc1434d5175a3b42d414ead55f617b896d1 100644 (file)
@@ -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());
                }
                */
index fe767e6395462bb51f96df184efbba13fbdbff38..7feccc2e210e07036b1be387a55202710774f884 100644 (file)
@@ -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());
                }
                */
index 929b5749d49406631beb1538f7bcf3ab6a517c96..8e84af9fd384470a789694c10c3a52636dd22324 100644 (file)
@@ -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());
                }
                */
index 6b77073bea0fc3b97e4caafe63fce76642347edd..724fcdf62e60814d0dad96a07fdca3554d2a56e6 100644 (file)
@@ -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());
                }
                */
index 24bc32dd1f444e062bf20852c93bbc890e478697..62dac6e6eef59da33fa8e77fcdf14f9547589f97 100644 (file)
@@ -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;
          }
index 52602114ed8d2e9ebf1a5419da920a38efb90c1b..7f15341e9cb8728fcd7ef1436ae781272d96a6f8 100644 (file)
@@ -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;
                }
 
index cf07bfd9d5727cfb48c4f51801f1ef67b8080da9..993b457f830ab3ebe057e8ecd16622487d9de2d0 100644 (file)
@@ -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());
index 9db8f629b5fb30a09940a1ef0d64f2aab17cb469..baf8d440ea744afd6f64a4fe5aa8c00761fccba5 100644 (file)
@@ -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;
        }
 
        /**
index 0ac3e846e6c9d37c8bc4cba5c866dd7938207aaa..7bd898e9bf71296f70ea640df3781dc856f48e2e 100644 (file)
@@ -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));
                }
        }
 
index c76e9195656c7a7120bbdbfa8a0d2ff33a610cfa..bfef435ec7e7f47b99795439d43fa9b15e64377c 100644 (file)
@@ -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);
index 1617cb22b85091e782ee20c079dad10a8213617b..9ee4c0962776ba5eec1b349fa884ff85dc7202b8 100644 (file)
@@ -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--) {
index ef1a1f2f997c6b588aef1fa3dd986875699c8264..5f36e7e808b3d8d3f2f7916ce95bc7850369eb7d 100644 (file)
@@ -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);
index 3ab35167ca6f12e6a13a2fc538090a7d799e2888..bbe5e1892b64c90e69dedc002e538b5bb8b2ea7a 100644 (file)
@@ -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());
index 1ca86c37118b4d26aaf3aa1761547862ac4e6c1b..c6656fcff367150bce23c720910b93d63db429c3 100644 (file)
@@ -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();