aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc/src
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 /ajdoc/src
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 'ajdoc/src')
-rw-r--r--ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java8
-rw-r--r--ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java4
-rw-r--r--ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java2
-rw-r--r--ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java2
-rw-r--r--ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java18
-rw-r--r--ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java10
6 files changed, 22 insertions, 22 deletions
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()?"&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>",
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()?"&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 " +