RFR JDK-8066709 Make some JDK system properties read only

Stuart Marks stuart.marks at oracle.com
Tue Jun 5 01:52:55 UTC 2018



On 6/4/18 6:32 AM, Roger Riggs wrote:
> 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

Hi Roger,

Overall I think the intent of the change is a good one, as is the 
reimplementation of internal uses of system properties to use an internal API 
instead.

I think it would be good to have an explicit initialization of the 
SystemProperty class (or whatever it ends up being called) instead of implicitly 
initializing via a static initializer. If the class is initialized too early, 
for some reason, things would go wrong.

Should there be an error, a warning, or assertion checking to make sure that 
none of the cached values are null? They should all be non-null, right?

s'marks


More information about the core-libs-dev mailing list