This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new a604dc79 Remove runtime guards below the Java 8 floor
a604dc79 is described below
commit a604dc79d53c9650ec21e1a7b18dda74594a6369
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Nov 4 13:40:57 2026 +0000
Remove runtime guards below the Java 8 floor
The -Xdoclint guard and the Apple JDK 1.6 branch compared the plugin's own
JVM with 1.8 and 1.7, which Java 8 always passes; the javadoc tool version
checks are untouched.
---
.../maven/plugins/javadoc/AbstractJavadocMojo.java | 76 +---------------------
.../maven/plugins/javadoc/JavadocJarMojoTest.java | 11 +---
2 files changed, 2 insertions(+), 85 deletions(-)
diff --git
a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index 4a53ea84..e90c1080 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -207,15 +207,6 @@ public abstract class AbstractJavadocMojo extends
AbstractMojo {
private static final String PACKAGE_LIST = "package-list";
private static final String ELEMENT_LIST = "element-list";
- /**
- * For Javadoc options appears since Java 8.0.
- * See <a
href="https://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/index.html">
- * Javadoc Technology</a>
- *
- * @since 3.0.0
- */
- private static final JavaVersion SINCE_JAVADOC_1_8 =
JavaVersion.parse("1.8");
-
private static final JavaVersion JAVA_VERSION =
JavaVersion.JAVA_SPECIFICATION_VERSION;
// ----------------------------------------------------------------------
@@ -3464,13 +3455,6 @@ public abstract class AbstractJavadocMojo extends
AbstractMojo {
if (SystemUtils.IS_OS_AIX) {
javadocExe =
new File(SystemUtils.getJavaHome() + File.separator + ".."
+ File.separator + "sh", javadocCommand);
- }
- // For Apple's JDK 1.6.x (and older?) on Mac OSX
- // CHECKSTYLE_OFF: MagicNumber
- else if (SystemUtils.IS_OS_MAC_OSX &&
!JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast("1.7"))
- // CHECKSTYLE_ON: MagicNumber
- {
- javadocExe = new File(SystemUtils.getJavaHome() + File.separator +
"bin", javadocCommand);
} else if
(isJavaVersionAtLeast(org.apache.commons.lang3.JavaVersion.JAVA_9)) {
javadocExe = new File(SystemUtils.getJavaHome() + File.separator +
"bin", javadocCommand);
} else {
@@ -3565,30 +3549,6 @@ public abstract class AbstractJavadocMojo extends
AbstractMojo {
}
}
- /**
- * Convenience method to add an argument to the <code>command line</code>
- * regarding the requested Java version.
- *
- * @param arguments a list of arguments, not null
- * @param b the flag which controls if the argument is
added or not.
- * @param value the argument value to be added.
- * @param requiredJavaVersion the required Java version, for example 1.31f
or 1.4f
- * @see #addArgIf(List, boolean, String)
- * @see #isJavaDocVersionAtLeast(JavaVersion)
- */
- private void addArgIf(List<String> arguments, boolean b, String value,
JavaVersion requiredJavaVersion) {
- if (b) {
- if (isJavaDocVersionAtLeast(requiredJavaVersion)) {
- addArgIf(arguments, true, value);
- } else {
- if (getLog().isWarnEnabled()) {
- getLog().warn(value + " option is not supported on Java
version < " + requiredJavaVersion
- + ". Ignore this option.");
- }
- }
- }
- }
-
/**
* Convenience method to add an argument to the <code>command line</code>
* if the value is not null or empty.
@@ -3604,40 +3564,6 @@ public abstract class AbstractJavadocMojo extends
AbstractMojo {
addArgIfNotEmpty(arguments, key, value, false);
}
- /**
- * Convenience method to add an argument to the <code>command line</code>
- * if the value is not null or empty.
- * <p/>
- * Moreover, the value could be comma separated.
- *
- * @param arguments a list of arguments, not null
- * @param key the argument name.
- * @param value the argument value to be added.
- * @param repeatKey repeat or not the key in the command line
- * @param splitValue if <code>true</code> given value will be
tokenized by comma
- * @param requiredJavaVersion the required Java version, for example 1.31f
or 1.4f
- * @see #addArgIfNotEmpty(List, String, String, boolean, boolean)
- * @see #isJavaDocVersionAtLeast(JavaVersion)
- */
- private void addArgIfNotEmpty(
- List<String> arguments,
- String key,
- String value,
- boolean repeatKey,
- boolean splitValue,
- JavaVersion requiredJavaVersion) {
- if (value != null && !value.isEmpty()) {
- if (isJavaDocVersionAtLeast(requiredJavaVersion)) {
- addArgIfNotEmpty(arguments, key, value, repeatKey, splitValue);
- } else {
- if (getLog().isWarnEnabled()) {
- getLog().warn(key + " option is not supported on Java
version < " + requiredJavaVersion
- + ". Ignore this option.");
- }
- }
- }
- }
-
/**
* Convenience method to add an argument to the <code>command line</code>
* if the value is not null or empty.
@@ -4693,7 +4619,7 @@ public abstract class AbstractJavadocMojo extends
AbstractMojo {
addArgIf(arguments, docfilessubdirs, "-docfilessubdirs");
- addArgIf(arguments, (doclint != null && !doclint.isEmpty()),
"-Xdoclint:" + getDoclint(), SINCE_JAVADOC_1_8);
+ addArgIf(arguments, (doclint != null && !doclint.isEmpty()),
"-Xdoclint:" + getDoclint());
addArgIfNotEmpty(arguments, "-doctitle",
JavadocUtil.quotedArgument(getDoctitle()), false, false);
diff --git
a/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarMojoTest.java
b/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarMojoTest.java
index fec98924..53e698a8 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarMojoTest.java
@@ -40,7 +40,6 @@ import org.junit.jupiter.api.Test;
import static org.apache.commons.io.FileUtils.deleteDirectory;
import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir;
-import static
org.apache.maven.api.plugin.testing.MojoExtension.getVariableValueFromObject;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -97,15 +96,7 @@ class JavadocJarMojoTest {
} else {
assertTrue(set.contains("stylesheet.css"));
}
- JavaVersion javadocVersion = getVariableValueFromObject(mojo,
"javadocRuntimeVersion");
- if (javadocVersion.isBefore("1.7")) {
- assertTrue(set.contains("resources/inherit.gif"));
- } else if (javadocVersion.isBefore("1.8")) {
- assertTrue(set.contains("resources/background.gif") /* JDK7 */);
- } else {
- // JDK8 has no resources anymore
- assertFalse(set.contains("resources"));
- }
+ assertFalse(set.contains("resources"));
assertTrue(set.contains("javadocjar/def/package-use.html"));
assertTrue(set.contains("javadocjar/def/package-tree.html"));