Skip to content

Commit 45e6be2

Browse files
klueverGoogle Java Core Libraries
authored and
Google Java Core Libraries
committed
Deprecate Charsets constants.
RELNOTES=`base: Deprecated `Charsets` constants in favor of `StandardCharsets`. PiperOrigin-RevId: 699971004
1 parent 4d4b29c commit 45e6be2

File tree

2 files changed

+26
-70
lines changed

2 files changed

+26
-70
lines changed

android/guava/src/com/google/common/base/Charsets.java

+13-35
Original file line numberDiff line numberDiff line change
@@ -35,75 +35,53 @@
3535
@GwtCompatible(emulated = true)
3636
@ElementTypesAreNonnullByDefault
3737
public final class Charsets {
38-
private Charsets() {}
3938

4039
/**
4140
* US-ASCII: seven-bit ASCII, the Basic Latin block of the Unicode character set (ISO646-US).
4241
*
43-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
44-
* {@link StandardCharsets#US_ASCII} instead.
45-
*
42+
* @deprecated Use {@link StandardCharsets#US_ASCII} instead.
4643
*/
47-
@J2ktIncompatible
48-
@GwtIncompatible // Charset not supported by GWT
44+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
4945
public static final Charset US_ASCII = StandardCharsets.US_ASCII;
5046

5147
/**
5248
* ISO-8859-1: ISO Latin Alphabet Number 1 (ISO-LATIN-1).
5349
*
54-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
55-
* {@link StandardCharsets#ISO_8859_1} instead.
56-
*
50+
* @deprecated Use {@link StandardCharsets#ISO_8859_1} instead.
5751
*/
58-
public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;
52+
@Deprecated public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;
5953

6054
/**
6155
* UTF-8: eight-bit UCS Transformation Format.
6256
*
63-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
64-
* {@link StandardCharsets#UTF_8} instead.
65-
*
57+
* @deprecated Use {@link StandardCharsets#UTF_8} instead.
6658
*/
67-
public static final Charset UTF_8 = StandardCharsets.UTF_8;
59+
@Deprecated public static final Charset UTF_8 = StandardCharsets.UTF_8;
6860

6961
/**
7062
* UTF-16BE: sixteen-bit UCS Transformation Format, big-endian byte order.
7163
*
72-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
73-
* {@link StandardCharsets#UTF_16BE} instead.
74-
*
64+
* @deprecated Use {@link StandardCharsets#UTF_16BE} instead.
7565
*/
76-
@J2ktIncompatible
77-
@GwtIncompatible // Charset not supported by GWT
66+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
7867
public static final Charset UTF_16BE = StandardCharsets.UTF_16BE;
7968

8069
/**
8170
* UTF-16LE: sixteen-bit UCS Transformation Format, little-endian byte order.
8271
*
83-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
84-
* {@link StandardCharsets#UTF_16LE} instead.
85-
*
72+
* @deprecated Use {@link StandardCharsets#UTF_16LE} instead.
8673
*/
87-
@J2ktIncompatible
88-
@GwtIncompatible // Charset not supported by GWT
74+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
8975
public static final Charset UTF_16LE = StandardCharsets.UTF_16LE;
9076

9177
/**
9278
* UTF-16: sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order
9379
* mark.
9480
*
95-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
96-
* {@link StandardCharsets#UTF_16} instead.
97-
*
81+
* @deprecated Use {@link StandardCharsets#UTF_16} instead.
9882
*/
99-
@J2ktIncompatible
100-
@GwtIncompatible // Charset not supported by GWT
83+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
10184
public static final Charset UTF_16 = StandardCharsets.UTF_16;
10285

103-
/*
104-
* Please do not add new Charset references to this class, unless those character encodings are
105-
* part of the set required to be supported by all Java platform implementations! Any Charsets
106-
* initialized here may cause unexpected delays when this class is loaded. See the Charset
107-
* Javadocs for the list of built-in character encodings.
108-
*/
86+
private Charsets() {}
10987
}

guava/src/com/google/common/base/Charsets.java

+13-35
Original file line numberDiff line numberDiff line change
@@ -35,75 +35,53 @@
3535
@GwtCompatible(emulated = true)
3636
@ElementTypesAreNonnullByDefault
3737
public final class Charsets {
38-
private Charsets() {}
3938

4039
/**
4140
* US-ASCII: seven-bit ASCII, the Basic Latin block of the Unicode character set (ISO646-US).
4241
*
43-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
44-
* {@link StandardCharsets#US_ASCII} instead.
45-
*
42+
* @deprecated Use {@link StandardCharsets#US_ASCII} instead.
4643
*/
47-
@J2ktIncompatible
48-
@GwtIncompatible // Charset not supported by GWT
44+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
4945
public static final Charset US_ASCII = StandardCharsets.US_ASCII;
5046

5147
/**
5248
* ISO-8859-1: ISO Latin Alphabet Number 1 (ISO-LATIN-1).
5349
*
54-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
55-
* {@link StandardCharsets#ISO_8859_1} instead.
56-
*
50+
* @deprecated Use {@link StandardCharsets#ISO_8859_1} instead.
5751
*/
58-
public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;
52+
@Deprecated public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;
5953

6054
/**
6155
* UTF-8: eight-bit UCS Transformation Format.
6256
*
63-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
64-
* {@link StandardCharsets#UTF_8} instead.
65-
*
57+
* @deprecated Use {@link StandardCharsets#UTF_8} instead.
6658
*/
67-
public static final Charset UTF_8 = StandardCharsets.UTF_8;
59+
@Deprecated public static final Charset UTF_8 = StandardCharsets.UTF_8;
6860

6961
/**
7062
* UTF-16BE: sixteen-bit UCS Transformation Format, big-endian byte order.
7163
*
72-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
73-
* {@link StandardCharsets#UTF_16BE} instead.
74-
*
64+
* @deprecated Use {@link StandardCharsets#UTF_16BE} instead.
7565
*/
76-
@J2ktIncompatible
77-
@GwtIncompatible // Charset not supported by GWT
66+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
7867
public static final Charset UTF_16BE = StandardCharsets.UTF_16BE;
7968

8069
/**
8170
* UTF-16LE: sixteen-bit UCS Transformation Format, little-endian byte order.
8271
*
83-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
84-
* {@link StandardCharsets#UTF_16LE} instead.
85-
*
72+
* @deprecated Use {@link StandardCharsets#UTF_16LE} instead.
8673
*/
87-
@J2ktIncompatible
88-
@GwtIncompatible // Charset not supported by GWT
74+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
8975
public static final Charset UTF_16LE = StandardCharsets.UTF_16LE;
9076

9177
/**
9278
* UTF-16: sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order
9379
* mark.
9480
*
95-
* <p><b>Note:</b> this constant is now unnecessary and should be treated as deprecated; use
96-
* {@link StandardCharsets#UTF_16} instead.
97-
*
81+
* @deprecated Use {@link StandardCharsets#UTF_16} instead.
9882
*/
99-
@J2ktIncompatible
100-
@GwtIncompatible // Charset not supported by GWT
83+
@Deprecated @J2ktIncompatible @GwtIncompatible // Charset not supported by GWT
10184
public static final Charset UTF_16 = StandardCharsets.UTF_16;
10285

103-
/*
104-
* Please do not add new Charset references to this class, unless those character encodings are
105-
* part of the set required to be supported by all Java platform implementations! Any Charsets
106-
* initialized here may cause unexpected delays when this class is loaded. See the Charset
107-
* Javadocs for the list of built-in character encodings.
108-
*/
86+
private Charsets() {}
10987
}

0 commit comments

Comments
 (0)