aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2024-02-19 10:22:10 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2024-02-19 11:21:19 +0700
commit198957fd26d1e5cd347c0c1c3a0c9100295af4cf (patch)
tree38e4be75f6abf612b04cf4a938607a5acbe5f370 /util
parent08d0c4435b61512f55f8d0e357b09496fdbe155a (diff)
downloadaspectj-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 'util')
-rw-r--r--util/src/main/java/org/aspectj/util/LangUtil.java86
-rw-r--r--util/src/test/java/org/aspectj/util/LangUtilTest.java8
2 files changed, 8 insertions, 86 deletions
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));
}
}