1 /*
2 * Copyright (C) 2014 The Android Open Source Project
3 * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation. Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23 * or visit www.oracle.com if you need additional information or have any
24 * questions.
25 */
26
27
28 package java.lang;
29
30 import java.lang.reflect.Constructor;
31 import java.lang.reflect.Type;
32 import java.lang.reflect.GenericDeclaration;
33 import java.lang.reflect.TypeVariable;
34 import java.io.Serializable;
35 import java.lang.reflect.Array;
36 import java.lang.reflect.Modifier;
37 import java.lang.reflect.Method;
38 import java.lang.reflect.Field;
39 import java.lang.reflect.Member;
40 import java.lang.reflect.RecordComponent;
41 import java.io.InputStream;
42 import java.util.HashMap;
43
44 @SuppressWarnings({"unchecked", "deprecation", "all"})
45 public final class Class<T> implements java.io.Serializable, java.lang.reflect.GenericDeclaration, java.lang.reflect.Type, java.lang.reflect.AnnotatedElement {
46
Class()47 Class() { throw new RuntimeException("Stub!"); }
48
toString()49 @libcore.util.NonNull public java.lang.String toString() { throw new RuntimeException("Stub!"); }
50
toGenericString()51 @libcore.util.NonNull public java.lang.String toGenericString() { throw new RuntimeException("Stub!"); }
52
forName(@ibcore.util.NonNull java.lang.String className)53 @libcore.util.NonNull public static java.lang.Class<?> forName(@libcore.util.NonNull java.lang.String className) throws java.lang.ClassNotFoundException { throw new RuntimeException("Stub!"); }
54
forName(@ibcore.util.NonNull java.lang.String name, boolean initialize, @libcore.util.Nullable java.lang.ClassLoader loader)55 @libcore.util.NonNull public static java.lang.Class<?> forName(@libcore.util.NonNull java.lang.String name, boolean initialize, @libcore.util.Nullable java.lang.ClassLoader loader) throws java.lang.ClassNotFoundException { throw new RuntimeException("Stub!"); }
56
newInstance()57 @libcore.util.NonNull public native T newInstance() throws java.lang.IllegalAccessException, java.lang.InstantiationException;
58
isInstance(@ibcore.util.Nullable java.lang.Object obj)59 public boolean isInstance(@libcore.util.Nullable java.lang.Object obj) { throw new RuntimeException("Stub!"); }
60
isAssignableFrom(@ibcore.util.NonNull java.lang.Class<?> cls)61 public boolean isAssignableFrom(@libcore.util.NonNull java.lang.Class<?> cls) { throw new RuntimeException("Stub!"); }
62
isInterface()63 public boolean isInterface() { throw new RuntimeException("Stub!"); }
64
isArray()65 public boolean isArray() { throw new RuntimeException("Stub!"); }
66
isPrimitive()67 public boolean isPrimitive() { throw new RuntimeException("Stub!"); }
68
isAnnotation()69 public boolean isAnnotation() { throw new RuntimeException("Stub!"); }
70
isSynthetic()71 public boolean isSynthetic() { throw new RuntimeException("Stub!"); }
72
getName()73 @libcore.util.NonNull public java.lang.String getName() { throw new RuntimeException("Stub!"); }
74
getClassLoader()75 @libcore.util.Nullable public java.lang.ClassLoader getClassLoader() { throw new RuntimeException("Stub!"); }
76
getTypeParameters()77 public synchronized java.lang.reflect.@libcore.util.NonNull TypeVariable<java.lang.@libcore.util.NonNull Class<T>> @libcore.util.NonNull [] getTypeParameters() { throw new RuntimeException("Stub!"); }
78
getSuperclass()79 @libcore.util.Nullable public java.lang.Class<? super T> getSuperclass() { throw new RuntimeException("Stub!"); }
80
getGenericSuperclass()81 @libcore.util.Nullable public java.lang.reflect.Type getGenericSuperclass() { throw new RuntimeException("Stub!"); }
82
getPackage()83 @libcore.util.Nullable public java.lang.Package getPackage() { throw new RuntimeException("Stub!"); }
84
getPackageName()85 @libcore.util.NonNull public java.lang.String getPackageName() { throw new RuntimeException("Stub!"); }
86
getInterfaces()87 public java.lang.@libcore.util.NonNull Class<?> @libcore.util.NonNull [] getInterfaces() { throw new RuntimeException("Stub!"); }
88
getGenericInterfaces()89 public java.lang.reflect.@libcore.util.NonNull Type @libcore.util.NonNull [] getGenericInterfaces() { throw new RuntimeException("Stub!"); }
90
getComponentType()91 @libcore.util.Nullable public java.lang.Class<?> getComponentType() { throw new RuntimeException("Stub!"); }
92
getModifiers()93 public int getModifiers() { throw new RuntimeException("Stub!"); }
94
getSigners()95 public java.lang.@libcore.util.NonNull Object @libcore.util.Nullable [] getSigners() { throw new RuntimeException("Stub!"); }
96
getEnclosingMethod()97 @libcore.util.Nullable public java.lang.reflect.Method getEnclosingMethod() { throw new RuntimeException("Stub!"); }
98
getEnclosingConstructor()99 @libcore.util.Nullable public java.lang.reflect.Constructor<?> getEnclosingConstructor() { throw new RuntimeException("Stub!"); }
100
getDeclaringClass()101 @libcore.util.Nullable public native java.lang.Class<?> getDeclaringClass();
102
getEnclosingClass()103 @libcore.util.Nullable public native java.lang.Class<?> getEnclosingClass();
104
getSimpleName()105 @libcore.util.NonNull public java.lang.String getSimpleName() { throw new RuntimeException("Stub!"); }
106
getTypeName()107 @libcore.util.NonNull public java.lang.String getTypeName() { throw new RuntimeException("Stub!"); }
108
getCanonicalName()109 @libcore.util.Nullable public java.lang.String getCanonicalName() { throw new RuntimeException("Stub!"); }
110
isAnonymousClass()111 public native boolean isAnonymousClass();
112
isLocalClass()113 public boolean isLocalClass() { throw new RuntimeException("Stub!"); }
114
isMemberClass()115 public boolean isMemberClass() { throw new RuntimeException("Stub!"); }
116
getClasses()117 public java.lang.@libcore.util.NonNull Class<?> @libcore.util.NonNull [] getClasses() { throw new RuntimeException("Stub!"); }
118
getFields()119 public java.lang.reflect.@libcore.util.NonNull Field @libcore.util.NonNull [] getFields() throws java.lang.SecurityException { throw new RuntimeException("Stub!"); }
120
getMethods()121 public java.lang.reflect.@libcore.util.NonNull Method @libcore.util.NonNull [] getMethods() throws java.lang.SecurityException { throw new RuntimeException("Stub!"); }
122
getConstructors()123 public java.lang.reflect.@libcore.util.NonNull Constructor<?> @libcore.util.NonNull [] getConstructors() throws java.lang.SecurityException { throw new RuntimeException("Stub!"); }
124
getField(@ibcore.util.NonNull java.lang.String name)125 @libcore.util.NonNull public java.lang.reflect.Field getField(@libcore.util.NonNull java.lang.String name) throws java.lang.NoSuchFieldException { throw new RuntimeException("Stub!"); }
126
getMethod(@ibcore.util.NonNull java.lang.String name, java.lang.@libcore.util.NonNull Class<?> @libcore.util.Nullable ... parameterTypes)127 @libcore.util.NonNull public java.lang.reflect.Method getMethod(@libcore.util.NonNull java.lang.String name, java.lang.@libcore.util.NonNull Class<?> @libcore.util.Nullable ... parameterTypes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { throw new RuntimeException("Stub!"); }
128
getConstructor(java.lang.@ibcore.util.NonNull Class<?> @ibcore.util.Nullable .... parameterTypes)129 @libcore.util.NonNull public java.lang.reflect.Constructor<T> getConstructor(java.lang.@libcore.util.NonNull Class<?> @libcore.util.Nullable ... parameterTypes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { throw new RuntimeException("Stub!"); }
130
getDeclaredClasses()131 public native java.lang.@libcore.util.NonNull Class<?> @libcore.util.NonNull [] getDeclaredClasses();
132
getDeclaredFields()133 public native java.lang.reflect.@libcore.util.NonNull Field @libcore.util.NonNull [] getDeclaredFields();
134
getDeclaredMethods()135 public java.lang.reflect.@libcore.util.NonNull Method @libcore.util.NonNull [] getDeclaredMethods() throws java.lang.SecurityException { throw new RuntimeException("Stub!"); }
136
getDeclaredConstructors()137 public java.lang.reflect.@libcore.util.NonNull Constructor<?> @libcore.util.NonNull [] getDeclaredConstructors() throws java.lang.SecurityException { throw new RuntimeException("Stub!"); }
138
getDeclaredField(@ibcore.util.NonNull java.lang.String name)139 @libcore.util.NonNull public native java.lang.reflect.Field getDeclaredField(@libcore.util.NonNull java.lang.String name) throws java.lang.NoSuchFieldException;
140
getDeclaredMethod(@ibcore.util.NonNull java.lang.String name, java.lang.@libcore.util.NonNull Class<?> @libcore.util.Nullable ... parameterTypes)141 @libcore.util.NonNull public java.lang.reflect.Method getDeclaredMethod(@libcore.util.NonNull java.lang.String name, java.lang.@libcore.util.NonNull Class<?> @libcore.util.Nullable ... parameterTypes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { throw new RuntimeException("Stub!"); }
142
getDeclaredConstructor(java.lang.@ibcore.util.NonNull Class<?> @ibcore.util.Nullable .... parameterTypes)143 @libcore.util.NonNull public java.lang.reflect.Constructor<T> getDeclaredConstructor(java.lang.@libcore.util.NonNull Class<?> @libcore.util.Nullable ... parameterTypes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { throw new RuntimeException("Stub!"); }
144
getResourceAsStream(@ibcore.util.NonNull java.lang.String name)145 @libcore.util.Nullable public java.io.InputStream getResourceAsStream(@libcore.util.NonNull java.lang.String name) { throw new RuntimeException("Stub!"); }
146
getResource(@ibcore.util.NonNull java.lang.String name)147 @libcore.util.Nullable public java.net.URL getResource(@libcore.util.NonNull java.lang.String name) { throw new RuntimeException("Stub!"); }
148
getProtectionDomain()149 @libcore.util.Nullable public java.security.ProtectionDomain getProtectionDomain() { throw new RuntimeException("Stub!"); }
150
desiredAssertionStatus()151 public boolean desiredAssertionStatus() { throw new RuntimeException("Stub!"); }
152
isEnum()153 public boolean isEnum() { throw new RuntimeException("Stub!"); }
154
155 // TODO: Make return type @NonNull T @Nullable [] once metalava supports TYPE_USE.
getEnumConstants()156 public T @libcore.util.Nullable [] getEnumConstants() { throw new RuntimeException("Stub!"); }
157
cast(@ibcore.util.Nullable java.lang.Object obj)158 @libcore.util.Nullable public T cast(@libcore.util.Nullable java.lang.Object obj) { throw new RuntimeException("Stub!"); }
159
asSubclass(@ibcore.util.NonNull java.lang.Class<U> clazz)160 @libcore.util.NonNull public <U> java.lang.Class<? extends U> asSubclass(@libcore.util.NonNull java.lang.Class<U> clazz) { throw new RuntimeException("Stub!"); }
161
getAnnotation(@ibcore.util.NonNull java.lang.Class<A> annotationClass)162 @libcore.util.Nullable public <A extends java.lang.annotation.Annotation> A getAnnotation(@libcore.util.NonNull java.lang.Class<A> annotationClass) { throw new RuntimeException("Stub!"); }
163
isAnnotationPresent(@ibcore.util.NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)164 public boolean isAnnotationPresent(@libcore.util.NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) { throw new RuntimeException("Stub!"); }
165
getAnnotationsByType(@ibcore.util.NonNull java.lang.Class<A> annotationClass)166 public <A extends java.lang.annotation.Annotation> @libcore.util.NonNull A @libcore.util.NonNull [] getAnnotationsByType(@libcore.util.NonNull java.lang.Class<A> annotationClass) { throw new RuntimeException("Stub!"); }
167
getDeclaredAnnotationsByType(@ibcore.util.NonNull java.lang.Class<A> annotationClass)168 public <A extends java.lang.annotation.Annotation> @libcore.util.NonNull A @libcore.util.NonNull [] getDeclaredAnnotationsByType(@libcore.util.NonNull java.lang.Class<A> annotationClass) { throw new RuntimeException("Stub!"); }
169
getAnnotations()170 public java.lang.annotation.@libcore.util.NonNull Annotation @libcore.util.NonNull [] getAnnotations() { throw new RuntimeException("Stub!"); }
171
getDeclaredAnnotation(@ibcore.util.NonNull java.lang.Class<A> annotationClass)172 public native <A extends java.lang.annotation.Annotation> @libcore.util.Nullable A getDeclaredAnnotation(@libcore.util.NonNull java.lang.Class<A> annotationClass);
173
getDeclaredAnnotations()174 public native java.lang.annotation.@libcore.util.NonNull Annotation @libcore.util.NonNull [] getDeclaredAnnotations();
175
getNestHost()176 public @libcore.util.NonNull Class<?> getNestHost();
177
isNestmateOf(@ibcore.util.NonNull Class<?> c)178 public boolean isNestmateOf(@libcore.util.NonNull Class<?> c);
179
getNestMembers()180 public @libcore.util.NonNull Class<?> @libcore.util.NonNull [] getNestMembers();
181
getPermittedSubclasses()182 public @libcore.util.Nullable Class<?> @libcore.util.NonNull [] getPermittedSubclasses();
183
isSealed()184 public boolean isSealed() { throw new RuntimeException("Stub!"); }
185
componentType()186 public @libcore.util.Nullable Class<?> componentType();
187
arrayType()188 public @libcore.util.NonNull Class<?> arrayType();
189
descriptorString()190 public @libcore.util.NonNull String descriptorString();
191
getRecordComponents()192 public @libcore.util.Nullable java.lang.reflect.RecordComponent @libcore.util.NonNull [] getRecordComponents();
193 }
194