1 /*
2 * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
54 static JNINativeMethod methods[] = {
55 {"getName0", "()" STR, (void *)&JVM_GetClassName},
56 {"getSuperclass", "()" CLS, NULL},
57 {"getInterfaces0", "()[" CLS, (void *)&JVM_GetClassInterfaces},
58 {"isInterface", "()Z", (void *)&JVM_IsInterface},
59 {"getSigners", "()[" OBJ, (void *)&JVM_GetClassSigners},
60 {"setSigners", "([" OBJ ")V", (void *)&JVM_SetClassSigners},
61 {"isArray", "()Z", (void *)&JVM_IsArrayClass},
62 {"isPrimitive", "()Z", (void *)&JVM_IsPrimitiveClass},
63 {"getModifiers", "()I", (void *)&JVM_GetClassModifiers},
64 {"getDeclaredFields0","(Z)[" FLD, (void *)&JVM_GetClassDeclaredFields},
65 {"getDeclaredMethods0","(Z)[" MHD, (void *)&JVM_GetClassDeclaredMethods},
66 {"getDeclaredConstructors0","(Z)[" CTR, (void *)&JVM_GetClassDeclaredConstructors},
67 {"getProtectionDomain0", "()" PD, (void *)&JVM_GetProtectionDomain},
68 {"getDeclaredClasses0", "()[" CLS, (void *)&JVM_GetDeclaredClasses},
69 {"getDeclaringClass0", "()" CLS, (void *)&JVM_GetDeclaringClass},
70 {"getSimpleBinaryName0", "()" STR, (void *)&JVM_GetSimpleBinaryName},
71 {"getGenericSignature0", "()" STR, (void *)&JVM_GetClassSignature},
72 {"getRawAnnotations", "()" BA, (void *)&JVM_GetClassAnnotations},
73 {"getConstantPool", "()" CPL, (void *)&JVM_GetClassConstantPool},
74 {"desiredAssertionStatus0","("CLS")Z",(void *)&JVM_DesiredAssertionStatus},
75 {"getEnclosingMethod0", "()[" OBJ, (void *)&JVM_GetEnclosingMethodInfo},
76 {"getRawTypeAnnotations", "()" BA, (void *)&JVM_GetClassTypeAnnotations},
77 };
78
79 #undef OBJ
80 #undef CLS
81 #undef STR
82 #undef FLD
83 #undef MHD
84 #undef CTR
85 #undef PD
86
87 JNIEXPORT void JNICALL
88 Java_java_lang_Class_registerNatives(JNIEnv *env, jclass cls)
89 {
90 methods[1].fnPtr = (void *)(*env)->GetSuperclass;
91 (*env)->RegisterNatives(env, cls, methods,
92 sizeof(methods)/sizeof(JNINativeMethod));
93 }
94
95 JNIEXPORT jclass JNICALL
96 Java_java_lang_Class_forName0(JNIEnv *env, jclass this, jstring classname,
|
1 /*
2 * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
54 static JNINativeMethod methods[] = {
55 {"getName0", "()" STR, (void *)&JVM_GetClassName},
56 {"getSuperclass", "()" CLS, NULL},
57 {"getInterfaces0", "()[" CLS, (void *)&JVM_GetClassInterfaces},
58 {"isInterface", "()Z", (void *)&JVM_IsInterface},
59 {"getSigners", "()[" OBJ, (void *)&JVM_GetClassSigners},
60 {"setSigners", "([" OBJ ")V", (void *)&JVM_SetClassSigners},
61 {"isArray", "()Z", (void *)&JVM_IsArrayClass},
62 {"isPrimitive", "()Z", (void *)&JVM_IsPrimitiveClass},
63 {"getModifiers", "()I", (void *)&JVM_GetClassModifiers},
64 {"getDeclaredFields0","(Z)[" FLD, (void *)&JVM_GetClassDeclaredFields},
65 {"getDeclaredMethods0","(Z)[" MHD, (void *)&JVM_GetClassDeclaredMethods},
66 {"getDeclaredConstructors0","(Z)[" CTR, (void *)&JVM_GetClassDeclaredConstructors},
67 {"getProtectionDomain0", "()" PD, (void *)&JVM_GetProtectionDomain},
68 {"getDeclaredClasses0", "()[" CLS, (void *)&JVM_GetDeclaredClasses},
69 {"getDeclaringClass0", "()" CLS, (void *)&JVM_GetDeclaringClass},
70 {"getSimpleBinaryName0", "()" STR, (void *)&JVM_GetSimpleBinaryName},
71 {"getGenericSignature0", "()" STR, (void *)&JVM_GetClassSignature},
72 {"getRawAnnotations", "()" BA, (void *)&JVM_GetClassAnnotations},
73 {"getConstantPool", "()" CPL, (void *)&JVM_GetClassConstantPool},
74 {"desiredAssertionStatus0","("CLS")Z", (void *)&JVM_DesiredAssertionStatus},
75 {"getEnclosingMethod0", "()[" OBJ, (void *)&JVM_GetEnclosingMethodInfo},
76 {"getRawTypeAnnotations", "()" BA, (void *)&JVM_GetClassTypeAnnotations},
77 {"getNestHost0", "()" CLS, (void *)&JVM_GetNestHost},
78 {"getNestMembers0", "()[" CLS, (void *)&JVM_GetNestMembers},
79 };
80
81 #undef OBJ
82 #undef CLS
83 #undef STR
84 #undef FLD
85 #undef MHD
86 #undef CTR
87 #undef PD
88
89 JNIEXPORT void JNICALL
90 Java_java_lang_Class_registerNatives(JNIEnv *env, jclass cls)
91 {
92 methods[1].fnPtr = (void *)(*env)->GetSuperclass;
93 (*env)->RegisterNatives(env, cls, methods,
94 sizeof(methods)/sizeof(JNINativeMethod));
95 }
96
97 JNIEXPORT jclass JNICALL
98 Java_java_lang_Class_forName0(JNIEnv *env, jclass this, jstring classname,
|