76 }
77 // invoke j.l.Class.isHidden() method
78 return jni->CallBooleanMethod(klass, is_hid_mid);
79 }
80
81 /* Check the class signature matches the expected. */
82 static void
83 check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden, const char* exp_sig) {
84 jint class_modifiers = 0;
85 char* sig = NULL;
86 char* gsig = NULL;
87 jvmtiError err;
88
89 err = jvmti->GetClassSignature(klass, &sig, &gsig);
90 CHECK_JVMTI_ERROR(jni, err, "check_hidden_class: Error in JVMTI GetClassSignature");
91
92 LOG1("check_class_signature: class with sig: %s\n", sig);
93 LOG1("check_class_signature: class with gsig: %s\n", gsig);
94
95 if (strcmp(sig, exp_sig) != 0) {
96 LOG2("check_class_signature: FAIL: Hidden class signature %s does not mach expected: %s\n", sig, exp_sig);
97 failed = true;
98 }
99 if (is_hidden && gsig == NULL) {
100 LOG0("check_class_signature: FAIL: unexpected NULL generic signature for hidden class\n");
101 failed = true;
102 }
103 }
104
105 /* Test hidden class flags: it should not be interface, array nor modifiable. */
106 static void
107 check_hidden_class_flags(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
108 jint modifiers = 0;
109 jboolean flag = false;
110 jvmtiError err;
111
112 err = jvmti->GetClassModifiers(klass, &modifiers);
113 CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_flags: Error in JVMTI GetClassModifiers");
114 LOG1("check_hidden_class_flags: hidden class modifiers: 0x%x\n", modifiers);
115 if ((modifiers & ACC_INTERFACE) != 0) {
116 LOG0("check_hidden_class_flags: FAIL: unexpected ACC_INTERFACE bit in hidden class modifiers\n");
|
76 }
77 // invoke j.l.Class.isHidden() method
78 return jni->CallBooleanMethod(klass, is_hid_mid);
79 }
80
81 /* Check the class signature matches the expected. */
82 static void
83 check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden, const char* exp_sig) {
84 jint class_modifiers = 0;
85 char* sig = NULL;
86 char* gsig = NULL;
87 jvmtiError err;
88
89 err = jvmti->GetClassSignature(klass, &sig, &gsig);
90 CHECK_JVMTI_ERROR(jni, err, "check_hidden_class: Error in JVMTI GetClassSignature");
91
92 LOG1("check_class_signature: class with sig: %s\n", sig);
93 LOG1("check_class_signature: class with gsig: %s\n", gsig);
94
95 if (strcmp(sig, exp_sig) != 0) {
96 LOG2("check_class_signature: FAIL: Hidden class signature %s does not match expected: %s\n", sig, exp_sig);
97 failed = true;
98 }
99 if (is_hidden && gsig == NULL) {
100 LOG0("check_class_signature: FAIL: unexpected NULL generic signature for hidden class\n");
101 failed = true;
102 }
103 }
104
105 /* Test hidden class flags: it should not be interface, array nor modifiable. */
106 static void
107 check_hidden_class_flags(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
108 jint modifiers = 0;
109 jboolean flag = false;
110 jvmtiError err;
111
112 err = jvmti->GetClassModifiers(klass, &modifiers);
113 CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_flags: Error in JVMTI GetClassModifiers");
114 LOG1("check_hidden_class_flags: hidden class modifiers: 0x%x\n", modifiers);
115 if ((modifiers & ACC_INTERFACE) != 0) {
116 LOG0("check_hidden_class_flags: FAIL: unexpected ACC_INTERFACE bit in hidden class modifiers\n");
|