From 1b0ac44dc65d45b5b810fe9a5db7c35991114db4 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Tue, 27 Jan 2026 08:03:28 -0500 Subject: [PATCH 1/3] Reorder cases to avoid skipping --- src/main/java/org/apache/maven/plugin/compiler/Options.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/maven/plugin/compiler/Options.java b/src/main/java/org/apache/maven/plugin/compiler/Options.java index 74e664e57..bc34e66a5 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/Options.java +++ b/src/main/java/org/apache/maven/plugin/compiler/Options.java @@ -320,13 +320,13 @@ private boolean checkNumberOfArguments(String option, int count, boolean immedia if (expected == count) { warning = null; return true; - } else if (expected < 1) { + } else if (expected == 0) { + warning = "The '" + option + "' option does not expect any argument."; + } else if (expected < 0) { if (checker instanceof ForkedCompiler) { return true; // That implementation actually knows nothing about which options are supported. } warning = "The '" + option + "' option is not supported."; - } else if (expected == 0) { - warning = "The '" + option + "' option does not expect any argument."; } else if (expected == 1) { warning = "The '" + option + "' option expects a single argument."; } else { From 9319a4ff65e59bd730f5bd1448d019db898d5040 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 28 Aug 2026 12:00:51 -0400 Subject: [PATCH 2/3] javadoc --- .../java/org/apache/maven/plugin/compiler/Options.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/maven/plugin/compiler/Options.java b/src/main/java/org/apache/maven/plugin/compiler/Options.java index bc34e66a5..e44e629e2 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/Options.java +++ b/src/main/java/org/apache/maven/plugin/compiler/Options.java @@ -306,14 +306,15 @@ public boolean addMemoryValue(String option, String label, String value, boolean * If not, a warning is logged if {@code immediate} is {@code true}, or stored in the * {@link #warning} field if {@code immediate} is {@code false}. * - *

If a message is stored in {@link #warning}, then it will always end with a dot. - * This guarantee allows callers to delete the last character and replace it by a coma + *

The message stored in {@link #warning} always ends with a dot. + * This guarantee allows callers to delete the last character and replace it with a comma * for continuing the sentence.

* * @param option the option to validate * @param count the number of arguments that the caller wants to provide * @param immediate whether to log immediately or to store the message in {@link #warning} - * @return whether the given option is supported and accepts the specified number of arguments + * @return true if the given option is supported and accepts the specified number of arguments, + * false otherwise */ private boolean checkNumberOfArguments(String option, int count, boolean immediate) { int expected = checker.isSupportedOption(option); From 4ee9ef27337a059e8839f01344ac4fa388ff3003 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 28 Aug 2026 12:01:53 -0400 Subject: [PATCH 3/3] fix --- src/main/java/org/apache/maven/plugin/compiler/Options.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/plugin/compiler/Options.java b/src/main/java/org/apache/maven/plugin/compiler/Options.java index e44e629e2..73c5d17ab 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/Options.java +++ b/src/main/java/org/apache/maven/plugin/compiler/Options.java @@ -321,13 +321,13 @@ private boolean checkNumberOfArguments(String option, int count, boolean immedia if (expected == count) { warning = null; return true; - } else if (expected == 0) { - warning = "The '" + option + "' option does not expect any argument."; } else if (expected < 0) { if (checker instanceof ForkedCompiler) { return true; // That implementation actually knows nothing about which options are supported. } warning = "The '" + option + "' option is not supported."; + } else if (expected == 0) { + warning = "The '" + option + "' option does not expect any argument."; } else if (expected == 1) { warning = "The '" + option + "' option expects a single argument."; } else {