This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git
The following commit(s) were added to refs/heads/master by this push:
new 1e89544d Javadoc: Note that parsed option values are converted on
every call (#447)
1e89544d is described below
commit 1e89544d035683439a59c46302cb3ef13883c908
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Oct 29 02:50:55 2026 +0100
Javadoc: Note that parsed option values are converted on every call (#447)
getParsedOptionValue() and getParsedOptionValues() run the option's
Converter each time they are called and don't cache the result. That
doesn't matter for numbers or strings, but with a converter that has
side effects, like the default FileInputStream one, every call opens a
new stream. Mention it in the CommandLine class Javadoc.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
src/main/java/org/apache/commons/cli/CommandLine.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/main/java/org/apache/commons/cli/CommandLine.java
b/src/main/java/org/apache/commons/cli/CommandLine.java
index 2942d5f9..5498e3fe 100644
--- a/src/main/java/org/apache/commons/cli/CommandLine.java
+++ b/src/main/java/org/apache/commons/cli/CommandLine.java
@@ -37,6 +37,11 @@ import java.util.function.Supplier;
* <p>
* Additionally, any left-over or unrecognized arguments, are available for
further processing.
* </p>
+ * <p>
+ * The {@code getParsedOptionValue} and {@code getParsedOptionValues} methods
apply the option's {@link Converter} on every call and do not cache the result,
+ * so a converter with side effects repeats them on each call. For example,
the default converter for {@code FileInputStream} options opens a new stream
+ * every time.
+ * </p>
*/
public class CommandLine implements Serializable {