Integrated: 8351740: Clean up some code around initialization of encoding properties

Stuart Marks smarks at openjdk.org
Thu Apr 10 21:46:35 UTC 2025


On Fri, 4 Apr 2025 23:42:26 GMT, Stuart Marks <smarks at openjdk.org> wrote:

> Some of the code that creates various encoding properties at JVM initialization time, such as file.encoding and native.encoding, could use some cleaning up. Cleanup is fairly minimal and should be mostly behavior-preserving. Changes include the following:
> 
> * In the java_props.h and java_props_md.c files, add documentation and asserts that the sprops.encoding and sprops.sun_jnu_encoding members are always set to non-NULL by the platform-specific code.
> 
> * In SystemProps.java, remove a null check that is now extraneous based on the above assertion.
> 
> * In SystemProps.java, rearrange logic (with no behavior change) around handling of the "COMPAT" value for the file.encoding property.
> 
> * In SystemProps.Raw, rename the platform properties array index from _file_encoding_NDX to _native_encoding_NDX.
> 
> * In SystemProps.Raw.cmdProperties(), adjust the HashMap size computation. This should actually avoid resizing of the HashMap (unlike the earlier code).
> 
> * Adjust various comments in several places for clarity and correctness.

This pull request has now been integrated.

Changeset: 83c7d3bb
Author:    Stuart Marks <smarks at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/83c7d3bbe860656ee403fa29df6a9e0aae962839
Stats:     56 lines in 5 files changed: 19 ins; 8 del; 29 mod

8351740: Clean up some code around initialization of encoding properties

Reviewed-by: naoto, alanb, rriggs

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

PR: https://git.openjdk.org/jdk/pull/24463


More information about the core-libs-dev mailing list