RFR JDK-8066709 Make some JDK system properties read only

Wang Weijun weijun.wang at oracle.com
Mon Jun 4 15:41:09 UTC 2018


Not a native English speaker, so my feeling might be incorrect.

Will someone interpret this as that System.getProperty() will return a cached value?

I would say “Although getProperty() always returns the last value set by setProperty() (I assume this is the current behavior), it is not uncommon that consumers of a system property may read it once and cache the value it for later use, which means setting the property <strong>may not have the desired effect</strong>”.

I also don’t think it’s worth listing the 4 property names in the spec. Quite some other system properties are also cached. Listing them there could further suggests that calling getProperty() on them will return the cached value.

Thanks
Max

> 在 2018年6月4日,下午9:32,Roger Riggs <Roger.Riggs at oracle.com> 写道:
> 
> Please review a change to make the values of java.home, user.home, user.dir, and user.name
> effectively read-only for internal use.  The values are cached during initialization and the
> cached values are used.
> 
> Webrev:
>   http://cr.openjdk.java.net/~rriggs/webrev-static-property-8066709/
> 
> Issue:
>   https://bugs.openjdk.java.net/browse/JDK-8066709
> 
> CSR:
>   https://bugs.openjdk.java.net/browse/JDK-8204235
> 
> Thanks, Roger
> 
> 



More information about the core-libs-dev mailing list