Fix Version/s: 11
Compatibility Risk Description:Changing the value of the listed system properties via System.setProperty will no longer change the behavior of the base module implementation.
The initial property values will be cached during system initialization as set by the VM, launcher, or command line.
Interface Kind:System or security property
Standard system properties should not be modified after system initialization; behavior that depends on those properties is unpredictable if they are modified.
user.name should be read-only.
Changing standard system properties after initialization can unpredictably affect the behavior of the java runtime and lead to bug reports and maintenance issues.
Issues have been noted for
The specification for individual system properties varies, the behavior of some properties is specific about when the property is used and when it is cached, in other cases, it is unspecified. Developers may have dependencies on the current implementation and behavior.
The System property API does not have any provision to reject or prevent changing system properties except for the
Typically, the SecurityManager is not used and there is no protection against changing selected properties. A broader change is needed but raises compatibility concerns and is beyond the scope of this change.
There is no change to the ability to set properties on the command line or from the environment before the runtime is initialized.
A short term fix is to cache the system property values of essential properties and use the internally consistent and stable values.
To draw attention to the broader issue a note is added to
java.lang.System and a release note added to describe the specific properties values being cached.
Add an apiNote to the
Changing a standard system property may have unpredictable results unless otherwise specified. Property values may be cached during initialization or on first use. Setting a standard property after initialization using getProperties(), setProperties(Properties), setProperty(String, String), or clearProperty(String) may not have the desired effect.
Add an apiNote to
Changing a standard system property may have unpredictable results unless otherwise specified. See getProperties() for details.