Skip to content

Commit 5bdce9b

Browse files
author
Julia Boes
committedDec 9, 2020
8257639: Update usage of "type" terminology in java.lang.Enum & java.lang.Record
Reviewed-by: chegar, dfuchs
1 parent b4615c6 commit 5bdce9b

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed
 

‎src/java.base/share/classes/java/lang/Enum.java

+23-23
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040
import static java.util.Objects.requireNonNull;
4141

4242
/**
43-
* This is the common base class of all Java language enumeration types.
43+
* This is the common base class of all Java language enumeration classes.
4444
*
4545
* More information about enums, including descriptions of the
4646
* implicitly declared methods synthesized by the compiler, can be
4747
* found in section {@jls 8.9} of <cite>The Java Language
4848
* Specification</cite>.
4949
*
50-
* Enumeration types are all serializable and receive special handling
50+
* Enumeration classes are all serializable and receive special handling
5151
* by the serialization mechanism. The serialized representation used
5252
* for enum constants cannot be customized. Declarations of methods
5353
* and fields that would otherwise interact with serialization are
@@ -59,7 +59,7 @@
5959
* {@linkplain java.util.EnumSet set} and {@linkplain
6060
* java.util.EnumMap map} implementations are available.
6161
*
62-
* @param <E> The enum type subclass
62+
* @param <E> The type of the enum subclass
6363
* @serial exclude
6464
* @author Josh Bloch
6565
* @author Neal Gafter
@@ -71,7 +71,7 @@
7171
* @since 1.5
7272
*/
7373
@SuppressWarnings("serial") // No serialVersionUID needed due to
74-
// special-casing of enum types.
74+
// special-casing of enum classes.
7575
public abstract class Enum<E extends Enum<E>>
7676
implements Constable, Comparable<E>, Serializable {
7777
/**
@@ -126,7 +126,7 @@ public final int ordinal() {
126126
/**
127127
* Sole constructor. Programmers cannot invoke this constructor.
128128
* It is for use by code emitted by the compiler in response to
129-
* enum type declarations.
129+
* enum class declarations.
130130
*
131131
* @param name - The name of this enum constant, which is the identifier
132132
* used to declare it.
@@ -142,7 +142,7 @@ protected Enum(String name, int ordinal) {
142142
/**
143143
* Returns the name of this enum constant, as contained in the
144144
* declaration. This method may be overridden, though it typically
145-
* isn't necessary or desirable. An enum type should override this
145+
* isn't necessary or desirable. An enum class should override this
146146
* method when a more "programmer-friendly" string form exists.
147147
*
148148
* @return the name of this enum constant
@@ -236,41 +236,41 @@ public final Optional<EnumDesc<E>> describeConstable() {
236236
}
237237

238238
/**
239-
* Returns the enum constant of the specified enum type with the
239+
* Returns the enum constant of the specified enum class with the
240240
* specified name. The name must match exactly an identifier used
241-
* to declare an enum constant in this type. (Extraneous whitespace
241+
* to declare an enum constant in this class. (Extraneous whitespace
242242
* characters are not permitted.)
243243
*
244-
* <p>Note that for a particular enum type {@code T}, the
244+
* <p>Note that for a particular enum class {@code T}, the
245245
* implicitly declared {@code public static T valueOf(String)}
246246
* method on that enum may be used instead of this method to map
247247
* from a name to the corresponding enum constant. All the
248-
* constants of an enum type can be obtained by calling the
248+
* constants of an enum class can be obtained by calling the
249249
* implicit {@code public static T[] values()} method of that
250-
* type.
250+
* class.
251251
*
252-
* @param <T> The enum type whose constant is to be returned
253-
* @param enumType the {@code Class} object of the enum type from which
252+
* @param <T> The enum class whose constant is to be returned
253+
* @param enumClass the {@code Class} object of the enum class from which
254254
* to return a constant
255255
* @param name the name of the constant to return
256-
* @return the enum constant of the specified enum type with the
256+
* @return the enum constant of the specified enum class with the
257257
* specified name
258-
* @throws IllegalArgumentException if the specified enum type has
258+
* @throws IllegalArgumentException if the specified enum class has
259259
* no constant with the specified name, or the specified
260-
* class object does not represent an enum type
261-
* @throws NullPointerException if {@code enumType} or {@code name}
260+
* class object does not represent an enum class
261+
* @throws NullPointerException if {@code enumClass} or {@code name}
262262
* is null
263263
* @since 1.5
264264
*/
265-
public static <T extends Enum<T>> T valueOf(Class<T> enumType,
265+
public static <T extends Enum<T>> T valueOf(Class<T> enumClass,
266266
String name) {
267-
T result = enumType.enumConstantDirectory().get(name);
267+
T result = enumClass.enumConstantDirectory().get(name);
268268
if (result != null)
269269
return result;
270270
if (name == null)
271271
throw new NullPointerException("Name is null");
272272
throw new IllegalArgumentException(
273-
"No enum constant " + enumType.getCanonicalName() + "." + name);
273+
"No enum constant " + enumClass.getCanonicalName() + "." + name);
274274
}
275275

276276
/**
@@ -307,13 +307,13 @@ public static final class EnumDesc<E extends Enum<E>>
307307
/**
308308
* Constructs a nominal descriptor for the specified {@code enum} class and name.
309309
*
310-
* @param constantType a {@link ClassDesc} describing the {@code enum} class
310+
* @param constantClass a {@link ClassDesc} describing the {@code enum} class
311311
* @param constantName the unqualified name of the enum constant
312312
* @throws NullPointerException if any argument is null
313313
* @jvms 4.2.2 Unqualified Names
314314
*/
315-
private EnumDesc(ClassDesc constantType, String constantName) {
316-
super(ConstantDescs.BSM_ENUM_CONSTANT, requireNonNull(constantName), requireNonNull(constantType));
315+
private EnumDesc(ClassDesc constantClass, String constantName) {
316+
super(ConstantDescs.BSM_ENUM_CONSTANT, requireNonNull(constantName), requireNonNull(constantClass));
317317
}
318318

319319
/**

‎src/java.base/share/classes/java/lang/Record.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected Record() {}
101101
*
102102
* @implSpec
103103
* The implicitly provided implementation returns {@code true} if
104-
* and only if the argument is an instance of the same record type
104+
* and only if the argument is an instance of the same record class
105105
* as this record, and each component of this record is equal to
106106
* the corresponding component of the argument; otherwise, {@code
107107
* false} is returned. Equality of a component {@code c} is

0 commit comments

Comments
 (0)
Please sign in to comment.