/* * Get Method Modifiers * * For the method indicated by method, return the access flags * via modifiers_ptr. * * REQUIRED Functionality. */ jvmtiError JNICALL jvmtiGetMethodModifiers(jvmtiEnv* env, jmethodID method, jint* modifiers_ptr) { TRACE("GetMethodModifiers called"); SuspendEnabledChecker sec; /* * Check given env & current phase. */ jvmtiPhase phases[] = {JVMTI_PHASE_START, JVMTI_PHASE_LIVE}; CHECK_EVERYTHING(); if( !method ) return JVMTI_ERROR_NULL_POINTER; if( !modifiers_ptr ) return JVMTI_ERROR_NULL_POINTER; *modifiers_ptr = 0; Method* mtd = reinterpret_cast<Method*>(method); if( mtd->is_public() ) *modifiers_ptr |= ACC_PUBLIC; if( mtd->is_private() ) *modifiers_ptr |= ACC_PRIVATE; if( mtd->is_protected() ) *modifiers_ptr |= ACC_PROTECTED; if( mtd->is_static() ) *modifiers_ptr |= ACC_STATIC; if( mtd->is_final() ) *modifiers_ptr |= ACC_FINAL; if( mtd->is_synchronized() ) *modifiers_ptr |= ACC_SYNCHRONIZED; if( mtd->is_native() ) *modifiers_ptr |= ACC_NATIVE; if( mtd->is_abstract() ) *modifiers_ptr |= ACC_ABSTRACT; return JVMTI_ERROR_NONE; }
// Find all methods on this hierarchy that match this // method's erased (name, signature) bool visit() { PseudoScope* scope = PseudoScope::cast(current_data()); InstanceKlass* iklass = current_class(); Method* m = iklass->find_method(_method_name, _method_signature); // private interface methods are not candidates for default methods // invokespecial to private interface methods doesn't use default method logic // The overpasses are your supertypes' errors, we do not include them // future: take access controls into account for superclass methods if (m != NULL && !m->is_static() && !m->is_overpass() && (!iklass->is_interface() || m->is_public())) { if (_family == NULL) { _family = new StatefulMethodFamily(); } if (iklass->is_interface()) { StateRestorer* restorer = _family->record_method_and_dq_further(m); scope->add_mark(restorer); } else { // This is the rule that methods in classes "win" (bad word) over // methods in interfaces. This works because of single inheritance _family->set_target_if_empty(m); } } return true; }