< prev index next >
src/java.base/share/classes/java/util/Locale.java
Print this page
@@ -631,10 +631,11 @@
*/
public static final char UNICODE_LOCALE_EXTENSION = 'u';
/** serialization ID
*/
+ @java.io.Serial
static final long serialVersionUID = 9149081749638150636L;
/**
* Enum for specifying the type defined in ISO 3166. This enum is used to
* retrieve the two-letter ISO3166-1 alpha-2, three-letter ISO3166-1
@@ -2299,10 +2300,11 @@
* BCP47 private use subtags, all in lower case letters
* separated by HYPHEN-MINUS characters.
* (See <a href="java.base/java/util/Locale.html#getExtensionKeys()">getExtensionKeys()</a>,
* <a href="java.base/java/util/Locale.html#getExtension(char)">getExtension(char)</a>)
*/
+ @java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("language", String.class),
new ObjectStreamField("country", String.class),
new ObjectStreamField("variant", String.class),
new ObjectStreamField("hashcode", int.class),
@@ -2314,10 +2316,11 @@
* Serializes this <code>Locale</code> to the specified <code>ObjectOutputStream</code>.
* @param out the <code>ObjectOutputStream</code> to write
* @throws IOException
* @since 1.7
*/
+ @java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
ObjectOutputStream.PutField fields = out.putFields();
fields.put("language", baseLocale.getLanguage());
fields.put("script", baseLocale.getScript());
fields.put("country", baseLocale.getRegion());
@@ -2333,10 +2336,11 @@
* @throws IOException
* @throws ClassNotFoundException
* @throws IllformedLocaleException
* @since 1.7
*/
+ @java.io.Serial
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = in.readFields();
String language = (String)fields.get("language", "");
String script = (String)fields.get("script", "");
String country = (String)fields.get("country", "");
@@ -2369,10 +2373,11 @@
*
* @return an instance of <code>Locale</code> equivalent to
* the deserialized <code>Locale</code>.
* @throws java.io.ObjectStreamException
*/
+ @java.io.Serial
private Object readResolve() throws java.io.ObjectStreamException {
return getInstance(baseLocale.getLanguage(), baseLocale.getScript(),
baseLocale.getRegion(), baseLocale.getVariant(), localeExtensions);
}
< prev index next >