Module java.base
Package java.lang

# Class Class

≠
public final class Class<T>
extends java.lang.Object
implements java.io.Serializable, java.lang.constant.Constable, java.lang.reflect.AnnotatedElement, java.lang.reflect.GenericDeclaration, java.lang.reflect.Type, java.lang.invoke.TypeDescriptor.OfField<java.lang.Class<?>>

## Methods

- ≠
  public java.util.Set<java.lang.reflect.AccessFlag> accessFlags()
  Comparing jdk-master and valhalla-csr-open

  ### accessFlags

  public Set<AccessFlag> accessFlags()
  Returns an unmodifiable set of the access flags for this class, possibly empty. The `AccessFlags` may depend on the class file format version of the class.

  If the underlying class is an array class:

  - its `PUBLIC` , `PRIVATE` and `PROTECTED` access flags are the same as those of its component type
  - its `ABSTRACT` and `FINAL` flags are present
  - its `INTERFACE` flag is absent, even when the component type is an interface
  - when preview features are enabled, its `IDENTITY` flag is present

  If this `Class` object represents a primitive type or void, the flags are `PUBLIC` , `ABSTRACT` , and `FINAL` . For `Class` objects representing void, primitive types, and arrays, access flags are absent other than as specified above.

  Returns:
    an unmodifiable set of the access flags for this class, possibly empty
  See Java Virtual Machine Specification:
    4.1 The ClassFile Structure
    4.7.6 The InnerClasses Attribute
  Since:
    20
  See Also:
    - `getModifiers()`
- =
  public java.lang.Class<?> arrayType()
- =
  public <U> java.lang.Class<? extends U> asSubclass(java.lang.Class<U> arg0)
- =
  public T cast(java.lang.Object arg0)
- =
  public java.lang.Class<?> componentType()
- =
  public java.util.Optional<java.lang.constant.ClassDesc> describeConstable()
- =
  public java.lang.String descriptorString()
- =
  public boolean desiredAssertionStatus()
- =
  public static java.lang.Class<?> forName(java.lang.Module arg0, java.lang.String arg1)
- =
  public static java.lang.Class<?> forName(java.lang.String arg0) throws java.lang.ClassNotFoundException
- =
  public static java.lang.Class<?> forName(java.lang.String arg0, boolean arg1, java.lang.ClassLoader arg2) throws java.lang.ClassNotFoundException
- =
  public static java.lang.Class<?> forPrimitiveName(java.lang.String arg0)
- =
  public java.lang.reflect.AnnotatedType[] getAnnotatedInterfaces()
- =
  public java.lang.reflect.AnnotatedType getAnnotatedSuperclass()
- =
  public <A> A getAnnotation(java.lang.Class<A> arg0)
- =
  public java.lang.annotation.Annotation[] getAnnotations()
- =
  public <A> A[] getAnnotationsByType(java.lang.Class<A> arg0)
- =
  public java.lang.String getCanonicalName()
- =
  public java.lang.ClassLoader getClassLoader()
- =
  public java.lang.Class<?>[] getClasses()
- =
  public java.lang.Class<?> getComponentType()
- =
  public java.lang.reflect.Constructor<T> getConstructor(java.lang.Class<?>[] arg0) throws java.lang.NoSuchMethodException
- =
  public java.lang.reflect.Constructor<?>[] getConstructors()
- =
  public <A> A getDeclaredAnnotation(java.lang.Class<A> arg0)
- =
  public java.lang.annotation.Annotation[] getDeclaredAnnotations()
- =
  public <A> A[] getDeclaredAnnotationsByType(java.lang.Class<A> arg0)
- =
  public java.lang.Class<?>[] getDeclaredClasses()
- =
  public java.lang.reflect.Constructor<T> getDeclaredConstructor(java.lang.Class<?>[] arg0) throws java.lang.NoSuchMethodException
- =
  public java.lang.reflect.Constructor<?>[] getDeclaredConstructors()
- =
  public java.lang.reflect.Field getDeclaredField(java.lang.String arg0) throws java.lang.NoSuchFieldException
- =
  public java.lang.reflect.Field[] getDeclaredFields()
- =
  public java.lang.reflect.Method getDeclaredMethod(java.lang.String arg0, java.lang.Class<?>[] arg1) throws java.lang.NoSuchMethodException
- =
  public java.lang.reflect.Method[] getDeclaredMethods()
- =
  public java.lang.Class<?> getDeclaringClass()
- =
  public java.lang.Class<?> getEnclosingClass()
- =
  public java.lang.reflect.Constructor<?> getEnclosingConstructor()
- =
  public java.lang.reflect.Method getEnclosingMethod()
- =
  public T[] getEnumConstants()
- =
  public java.lang.reflect.Field getField(java.lang.String arg0) throws java.lang.NoSuchFieldException
- =
  public java.lang.reflect.Field[] getFields()
- =
  public java.lang.reflect.Type[] getGenericInterfaces()
- =
  public java.lang.reflect.Type getGenericSuperclass()
- =
  public java.lang.Class<?>[] getInterfaces()
- =
  public java.lang.reflect.Method getMethod(java.lang.String arg0, java.lang.Class<?>[] arg1) throws java.lang.NoSuchMethodException
- =
  public java.lang.reflect.Method[] getMethods()
- ≠
  public int getModifiers()
  Comparing jdk-master and valhalla-csr-open

  ### getModifiers

  public int getModifiers()
  Returns the Java language modifiers for this class or interface, encoded in an integer. The modifiers consist of the Java Virtual Machine's constants for `public` , `protected` , `private` , `final` , `static` , `abstract` and `interface` ; they should be decoded using the methods of class `Modifier` .

  If the underlying class is an array class:

  - its `public` , `private` and `protected` modifiers are the same as those of its component type
  - its `abstract` and `final` modifiers are always `true`
  - its interface modifier is always `false` , even when the component type is an interface
  - when preview features are enabled, its identityPREVIEW modifier is always true

  If this `Class` object represents a primitive type or void, its `public` , `abstract` , and `final` modifiers are always `true` . For `Class` objects representing void, primitive types, and arrays, the values of other modifiers are `false` other than as specified above.

  The modifier encodings are defined in section §4.1 of The Java Virtual Machine Specification .

  Returns:
    the `int` representing the modifiers for this class
  See Java Language Specification:
    8.1.1 Class Modifiers
    9.1.1 Interface Modifiers
  See Java Virtual Machine Specification:
    4.1 The `ClassFile` Structure
  Since:
    1.1
  See Also:
    - `Modifier`
    - `accessFlags()`
    - Java programming language and JVM modeling in core reflection
- =
  public java.lang.Module getModule()
- =
  public java.lang.String getName()
- =
  public java.lang.Class<?> getNestHost()
- =
  public java.lang.Class<?>[] getNestMembers()
- =
  public java.lang.Package getPackage()
- =
  public java.lang.String getPackageName()
- =
  public java.lang.Class<?>[] getPermittedSubclasses()
- =
  public java.security.ProtectionDomain getProtectionDomain()
- =
  public java.lang.reflect.RecordComponent[] getRecordComponents()
- =
  public java.net.URL getResource(java.lang.String arg0)
- =
  public java.io.InputStream getResourceAsStream(java.lang.String arg0)
- =
  public java.lang.Object[] getSigners()
- =
  public java.lang.String getSimpleName()
- =
  public java.lang.Class<? super T> getSuperclass()
- =
  public java.lang.String getTypeName()
- =
  public java.lang.reflect.TypeVariable<java.lang.Class<T>>[] getTypeParameters()
- =
  public boolean isAnnotation()
- =
  public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> arg0)
- =
  public boolean isAnonymousClass()
- =
  public boolean isArray()
- =
  public boolean isAssignableFrom(java.lang.Class<?> arg0)
- =
  public boolean isEnum()
- =
  public boolean isHidden()
- +Only in: valhalla-csr-open; not in: jdk-master.
  public boolean isIdentity()
  Not in jdk-master; only in valhalla-csr-open

  ### isIdentity

  public boolean isIdentity()
  `isIdentity` is a reflective preview API of the Java platform.
  Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  Returns `true` if this `Class` object represents an identity class, otherwise `false`.
  - If this `Class` object represents an array type this method returns `true`.
  - If this `Class` object represents an interface, a primitive type, or `void` this method returns `false`.
  - For all other `Class` objects, this method returns `true` if either preview features are disabled or IDENTITYPREVIEW is present in the class access flags.
  Returns:
    `true` if this `Class` object represents an identity class, otherwise `false`
  Since:
    Valhalla
  See Also:
    - `AccessFlag.IDENTITY`PREVIEW
- =
  public boolean isInstance(java.lang.Object arg0)
- =
  public boolean isInterface()
- =
  public boolean isLocalClass()
- =
  public boolean isMemberClass()
- =
  public boolean isNestmateOf(java.lang.Class<?> arg0)
- =
  public boolean isPrimitive()
- =
  public boolean isRecord()
- =
  public boolean isSealed()
- =
  public boolean isSynthetic()
- +Only in: valhalla-csr-open; not in: jdk-master.
  public boolean isValue()
  Not in jdk-master; only in valhalla-csr-open

  ### isValue

  public boolean isValue()
  `isValue` is a reflective preview API of the Java platform.
  Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  Returns `true` if this `Class` object represents a value class, otherwise `false`.
  - If this `Class` object represents an array type this method returns `false`.
  - If this `Class` object represents an interface, a primitive type, or `void` this method returns `true` only if preview features are enabled.
  - For all other `Class` objects, this method returns `true` only if preview features are enabled and IDENTITYPREVIEW is not present in the class access flags.
  Returns:
    `true` if this `Class` object represents a value class, otherwise `false`
  Since:
    Valhalla
  See Also:
    - `AccessFlag.IDENTITY`PREVIEW
- =
  @Deprecated(since="9")
  public T newInstance() throws java.lang.IllegalAccessException, java.lang.InstantiationException
- =
  public java.lang.String toGenericString()
- =
  public java.lang.String toString()

## Serialized Form

=

### serialVersionUID

=3206093459760846163

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
accessFlags() |  |  |  |  |  |  | 4 |  |  | 4
getModifiers() |  |  |  |  |  |  | 3 |  |  | 3
isIdentity() | 1 |  |  |  |  |  | 1 |  |  | 2
isValue() | 1 |  |  |  |  |  | 1 |  |  | 2
Total | 2 |  |  |  |  |  | 9 |  |  | 11