diff options
Diffstat (limited to 'src/java.base/share/classes/java/lang/System.java')
| -rw-r--r-- | src/java.base/share/classes/java/lang/System.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java index d775b9aecc3..c1dcff2e4ed 100644 --- a/src/java.base/share/classes/java/lang/System.java +++ b/src/java.base/share/classes/java/lang/System.java @@ -59,6 +59,7 @@ import java.util.function.Supplier; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; +import jdk.internal.util.StaticProperty; import jdk.internal.module.ModuleBootstrap; import jdk.internal.module.ServicesCatalog; import jdk.internal.reflect.CallerSensitive; @@ -669,7 +670,16 @@ public final class System { * {@code getProperties} operation, it may choose to permit the * {@link #getProperty(String)} operation. * - * @implNote In addition to the standard system properties, the system + * @apiNote + * <strong>Changing a standard system property may have unpredictable results + * unless otherwise specified.</strong> + * Property values may be cached during initialization or on first use. + * Setting a standard property after initialization using {@link #getProperties()}, + * {@link #setProperties(Properties)}, {@link #setProperty(String, String)}, or + * {@link #clearProperty(String)} may not have the desired effect. + * + * @implNote + * In addition to the standard system properties, the system * properties may include the following keys: * <table class="striped"> * <caption style="display:none">Shows property keys and associated values</caption> @@ -736,6 +746,11 @@ public final class System { * {@code null}, then the current set of system properties is * forgotten. * + * @apiNote + * <strong>Changing a standard system property may have unpredictable results + * unless otherwise specified</strong>. + * See {@linkplain #getProperties getProperties} for details. + * * @param props the new system properties. * @throws SecurityException if a security manager exists and its * {@code checkPropertiesAccess} method doesn't allow access @@ -768,6 +783,11 @@ public final class System { * properties is first created and initialized in the same manner as * for the {@code getProperties} method. * + * @apiNote + * <strong>Changing a standard system property may have unpredictable results + * unless otherwise specified</strong>. + * See {@linkplain #getProperties getProperties} for details. + * * @param key the name of the system property. * @return the string value of the system property, * or {@code null} if there is no property with that key. @@ -837,6 +857,11 @@ public final class System { * If no exception is thrown, the specified property is set to the given * value. * + * @apiNote + * <strong>Changing a standard system property may have unpredictable results + * unless otherwise specified</strong>. + * See {@linkplain #getProperties getProperties} for details. + * * @param key the name of the system property. * @param value the value of the system property. * @return the previous value of the system property, @@ -875,6 +900,11 @@ public final class System { * permission. This may result in a SecurityException being thrown. * If no exception is thrown, the specified property is removed. * + * @apiNote + * <strong>Changing a standard system property may have unpredictable results + * unless otherwise specified</strong>. + * See {@linkplain #getProperties getProperties} method for details. + * * @param key the name of the system property to be removed. * @return the previous string value of the system property, * or {@code null} if there was no property with that key. @@ -1927,6 +1957,7 @@ public final class System { VM.saveAndRemoveProperties(props); lineSeparator = props.getProperty("line.separator"); + StaticProperty.javaHome(); // Load StaticProperty to cache the property values VersionProps.init(); FileInputStream fdIn = new FileInputStream(FileDescriptor.in); |
