RFR: 8265989: System property for the native character encoding name

Naoto Sato naoto at openjdk.java.net
Thu Apr 29 13:09:54 UTC 2021

On Thu, 29 Apr 2021 05:38:21 GMT, Iris Clark <iris at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/System.java line 704:
>>> 702:      * <tr><th scope="row">{@systemProperty native.encoding}</th>
>>> 703:      *     <td>Character encoding name derived from the host environment and/or
>>> 704:      *     the user's settings. Setting this system property has no effect.</td></tr>
>> May be "This property is read-only" instead of "Setting this system property has no effect" to not confuse with "user's settings"?
> I suspect that if setProperty("native.encoding", "foo") succeeds, then it will return "foo".   I also believe that a later invocation of getProperty("native.encoding") will also return "foo".  If that's the case, then I don't think that the "read-only" alternative phrasing is correct.  To me, the alternative suggests that an error will be return if there is an attempt to set it or that the potential new value will be ignored.  The "no effect" phrasing avoids this problem.   I also suspect that the "no effect" phrasing was selected to align with the apiNote in lines 719-721.

Thanks, Joe and Iris. I agree with Iris and that's the reason I chose the description. System properties are inherently mutable. There are some "protected" ones, by that I mean a private copy is made just after initialization for VM use, which is not affected by later setProperty() calls. But I don't think this new property should be treated as such.


PR: https://git.openjdk.java.net/jdk/pull/3777

More information about the core-libs-dev mailing list