diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-19 10:22:10 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-19 11:21:19 +0700 |
commit | 198957fd26d1e5cd347c0c1c3a0c9100295af4cf (patch) | |
tree | 38e4be75f6abf612b04cf4a938607a5acbe5f370 /weaver | |
parent | 08d0c4435b61512f55f8d0e357b09496fdbe155a (diff) | |
download | aspectj-198957fd26d1e5cd347c0c1c3a0c9100295af4cf.tar.gz aspectj-198957fd26d1e5cd347c0c1c3a0c9100295af4cf.zip |
LangUtil: remove methods like 'is11VMOrGreater', 'is1dot5VMOrGreater'
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>
Diffstat (limited to 'weaver')
5 files changed, 8 insertions, 8 deletions
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(); |