< prev index next >

src/java.base/share/native/libjava/Class.c

Print this page




  43 
  44 #define OBJ "Ljava/lang/Object;"
  45 #define CLS "Ljava/lang/Class;"
  46 #define CPL "Ljdk/internal/reflect/ConstantPool;"
  47 #define STR "Ljava/lang/String;"
  48 #define FLD "Ljava/lang/reflect/Field;"
  49 #define MHD "Ljava/lang/reflect/Method;"
  50 #define CTR "Ljava/lang/reflect/Constructor;"
  51 #define PD  "Ljava/security/ProtectionDomain;"
  52 #define BA  "[B"
  53 
  54 static JNINativeMethod methods[] = {
  55     {"initClassName",    "()" STR,          (void *)&JVM_InitClassName},
  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




  43 
  44 #define OBJ "Ljava/lang/Object;"
  45 #define CLS "Ljava/lang/Class;"
  46 #define CPL "Ljdk/internal/reflect/ConstantPool;"
  47 #define STR "Ljava/lang/String;"
  48 #define FLD "Ljava/lang/reflect/Field;"
  49 #define MHD "Ljava/lang/reflect/Method;"
  50 #define CTR "Ljava/lang/reflect/Constructor;"
  51 #define PD  "Ljava/security/ProtectionDomain;"
  52 #define BA  "[B"
  53 
  54 static JNINativeMethod methods[] = {
  55     {"initClassName",    "()" STR,          (void *)&JVM_InitClassName},
  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     {"isHiddenClass",    "()Z",             (void *)&JVM_IsHiddenClass},
  64     {"getModifiers",     "()I",             (void *)&JVM_GetClassModifiers},
  65     {"getDeclaredFields0","(Z)[" FLD,       (void *)&JVM_GetClassDeclaredFields},
  66     {"getDeclaredMethods0","(Z)[" MHD,      (void *)&JVM_GetClassDeclaredMethods},
  67     {"getDeclaredConstructors0","(Z)[" CTR, (void *)&JVM_GetClassDeclaredConstructors},
  68     {"getProtectionDomain0", "()" PD,       (void *)&JVM_GetProtectionDomain},
  69     {"getDeclaredClasses0",  "()[" CLS,     (void *)&JVM_GetDeclaredClasses},
  70     {"getDeclaringClass0",   "()" CLS,      (void *)&JVM_GetDeclaringClass},
  71     {"getSimpleBinaryName0", "()" STR,      (void *)&JVM_GetSimpleBinaryName},
  72     {"getGenericSignature0", "()" STR,      (void *)&JVM_GetClassSignature},
  73     {"getRawAnnotations",      "()" BA,     (void *)&JVM_GetClassAnnotations},
  74     {"getConstantPool",     "()" CPL,       (void *)&JVM_GetClassConstantPool},
  75     {"desiredAssertionStatus0","("CLS")Z",  (void *)&JVM_DesiredAssertionStatus},
  76     {"getEnclosingMethod0", "()[" OBJ,      (void *)&JVM_GetEnclosingMethodInfo},
  77     {"getRawTypeAnnotations", "()" BA,      (void *)&JVM_GetClassTypeAnnotations},
  78     {"getNestHost0",         "(Z)" CLS,      (void *)&JVM_GetNestHost},
  79     {"getNestMembers0",      "()[" CLS,     (void *)&JVM_GetNestMembers},
  80 };
  81 
  82 #undef OBJ
  83 #undef CLS
  84 #undef STR
  85 #undef FLD
  86 #undef MHD
  87 #undef CTR
  88 #undef PD
  89 
  90 JNIEXPORT void JNICALL
  91 Java_java_lang_Class_registerNatives(JNIEnv *env, jclass cls)
  92 {
  93     methods[1].fnPtr = (void *)(*env)->GetSuperclass;
  94     (*env)->RegisterNatives(env, cls, methods,
  95                             sizeof(methods)/sizeof(JNINativeMethod));
  96 }
  97 
  98 JNIEXPORT jclass JNICALL


< prev index next >