You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2026/09/20 08:42:13 UTC

(lucene) branch branch_10x updated: Only pass -Xlint:dangling-doc-comments to javac 23+ (#16689)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_10x by this push:
     new e3a0a100271 Only pass -Xlint:dangling-doc-comments to javac 23+ (#16689)
e3a0a100271 is described below

commit e3a0a10027172f58ff3ffe1d7ae71a9e550463f0
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Sun Sep 20 10:42:06 2026 +0200

    Only pass -Xlint:dangling-doc-comments to javac 23+ (#16689)
    
    The dangling-doc-comments lint category was added in JDK 23, not JDK 22.
    Compiling with JDK 22 failed with "invalid flag: -Xlint:dangling-doc-comments"
    because the option was only removed for compilers older than 22.
    
    Co-authored-by: Claude Fable 5.1 <no...@anthropic.com>
---
 .../lucene/gradle/plugins/java/JavacConfigurationPlugin.java  | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/JavacConfigurationPlugin.java b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/JavacConfigurationPlugin.java
index f4aa50e266f..c88590968e4 100644
--- a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/JavacConfigurationPlugin.java
+++ b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/JavacConfigurationPlugin.java
@@ -121,13 +121,14 @@ public class JavacConfigurationPlugin extends LuceneGradlePlugin {
               // support yet (the minimum supported compiler is Java 21).
               JavaVersion compilerVersion = altJvmExt.getCompilationJvmVersion().get();
               if (compilerVersion.compareTo(JavaVersion.VERSION_22) < 0) {
-                // These lint categories were only added in Java 22.
-                compilerArgs.removeAll(
-                    List.of("-Xlint:dangling-doc-comments", "-Xlint:restricted"));
+                // This lint category was only added in Java 22.
+                compilerArgs.remove("-Xlint:restricted");
               }
               if (compilerVersion.compareTo(JavaVersion.VERSION_23) < 0) {
-                // This lint category is not supported by Java 21's javac.
-                compilerArgs.removeAll(List.of("-Xlint:incubating", "-Xlint:-incubating"));
+                // These lint categories were only added in Java 23.
+                compilerArgs.removeAll(
+                    List.of(
+                        "-Xlint:dangling-doc-comments", "-Xlint:incubating", "-Xlint:-incubating"));
               }
               if (compilerVersion.compareTo(JavaVersion.VERSION_25) < 0) {
                 // This lint category was only added in Java 25.