RFR: 8358530: enhanced Properties#list javadoc
cagliostro92
duke at openjdk.org
Tue Jul 15 09:39:20 UTC 2025
On Fri, 11 Jul 2025 20:51:38 GMT, Justin Lu <jlu at openjdk.org> wrote:
>> Trivial PR to enhance Javadoc for the `Properties#list` method, which has cost me some debugging time.
>
> It does appear true that a `ClassCastException` is thrown if a value is not a String for `Properties.list(PrintWriter)` and the behavior looks to be long-standing. A minimal update to make this apparent seems appropriate.
>
> I filed the following issue: [JDK-8358530](https://bugs.openjdk.org/browse/JDK-8358530) for this PR. I can create a CSR (to cover the specification changes) for you when the wording changes are finalized.
>
> The class description wording,
>
>> the call to the propertyNames or list method will fail if it is called on a "compromised" Properties object that contains a non-String key.
>
> should also probably get an update as well.
Hi @justin-curtis-lu I've just pushed a new commit following your suggestion. Would be great if you could create a CSR on my behalf. 🙂
> src/java.base/share/classes/java/util/Properties.java line 1240:
>
>> 1238: *
>> 1239: * @param out an output stream.
>> 1240: * @throws ClassCastException if either a key or a value
>
> This change can be applied to `Properties.list(PrintStream out)` as well.
solved with 7e28926d92f4d499b854894f9371f0bfd1f052b6
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25334#issuecomment-3072897583
PR Review Comment: https://git.openjdk.org/jdk/pull/25334#discussion_r2206977481
More information about the core-libs-dev
mailing list