--- old/src/java.base/share/classes/java/lang/String.java 2016-02-19 14:35:05.871659369 +0300 +++ new/src/java.base/share/classes/java/lang/String.java 2016-02-19 14:35:05.799659719 +0300 @@ -42,6 +42,7 @@ import java.util.stream.IntStream; import java.util.stream.StreamSupport; import jdk.internal.HotSpotIntrinsicCandidate; +import jdk.internal.vm.annotation.Stable; /** * The {@code String} class represents character strings. All @@ -119,7 +120,14 @@ public final class String implements java.io.Serializable, Comparable, CharSequence { - /** The value is used for character storage. */ + /** + * The value is used for character storage. + * + * @implNote This field is marked with {@link Stable} to trust the contents + * of the array. No other facility in JDK provides this functionality (yet). + * {@link Stable} is safe here, because value is never null. + */ + @Stable private final byte[] value; /** @@ -129,6 +137,10 @@ * LATIN1 * UTF16 * + * @implNote Note this field is not {@link Stable}, because we want + * LATIN1 (0) coder to fold too. {@link Stable} would not allow that, + * as it reserves the default value as "not initialized" value. + * Constant-folding this field is handled internally in VM. */ private final byte coder;