On Thu, 21 Sep 2023 10:09:23 GMT, Claes Redestad <[email protected]> wrote:

>> `DEFAULT_ENCODING_NAME ` in `URLEncoder` and `URLDecoder` can be replaced 
>> with `Charset.defaultCharset()`, which removes unnecessary static fields and 
>> avoid looking up charset when calling `URLDecoder.decode(String)` and 
>> `URLEncoder.encode(String)`.
>> 
>> This PR is trivial, since `Charset.defaultCharset()` is also initialized 
>> with `StaticProperty.fileEncoding()`, this causes no change in behavior. 
>> 
>> Moreover, the javadoc of `URLDecoder.decode(String)` and 
>> `URLEncoder.encode(String)` say that they use the default charset, so this 
>> change is semantically consistent with the documentation.
>
> Right, this only affects deprecated methods, so it's unclear who'd benefit. A 
> little less code and a couple of constants less is nice, I guess.

I ran tests in our CI and observed no failures linked to this PR - I would have 
sponsored today but @cl4es beat me to it :-)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15353#issuecomment-1744756279

Reply via email to