src/share/vm/interpreter/linkResolver.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_jdk8026065_1 Sdiff src/share/vm/interpreter

src/share/vm/interpreter/linkResolver.cpp

Print this page




 898   // and the selected method is recalculated relative to the direct superclass
 899   // superinterface.method, which explicitly does not check shadowing
 900 
 901   resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, false, CHECK);
 902 
 903   // check if method name is <init>, that it is found in same klass as static type
 904   if (resolved_method->name() == vmSymbols::object_initializer_name() &&
 905       resolved_method->method_holder() != resolved_klass()) {
 906     ResourceMark rm(THREAD);
 907     Exceptions::fthrow(
 908       THREAD_AND_LOCATION,
 909       vmSymbols::java_lang_NoSuchMethodError(),
 910       "%s: method %s%s not found",
 911       resolved_klass->external_name(),
 912       resolved_method->name()->as_C_string(),
 913       resolved_method->signature()->as_C_string()
 914     );
 915     return;
 916   }
 917 



















 918   // check if not static
 919   if (resolved_method->is_static()) {
 920     ResourceMark rm(THREAD);
 921     char buf[200];
 922     jio_snprintf(buf, sizeof(buf),
 923                  "Expecting non-static method %s",
 924                  Method::name_and_sig_as_C_string(resolved_klass(),
 925                                                          resolved_method->name(),
 926                                                          resolved_method->signature()));
 927     THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
 928   }
 929 
 930   if (TraceItables && Verbose) {
 931     ResourceMark rm(THREAD);
 932     tty->print("invokespecial resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
 933                 (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
 934                 (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
 935                 Method::name_and_sig_as_C_string(resolved_klass(),
 936                                                  resolved_method->name(),
 937                                                  resolved_method->signature()),




 898   // and the selected method is recalculated relative to the direct superclass
 899   // superinterface.method, which explicitly does not check shadowing
 900 
 901   resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, false, CHECK);
 902 
 903   // check if method name is <init>, that it is found in same klass as static type
 904   if (resolved_method->name() == vmSymbols::object_initializer_name() &&
 905       resolved_method->method_holder() != resolved_klass()) {
 906     ResourceMark rm(THREAD);
 907     Exceptions::fthrow(
 908       THREAD_AND_LOCATION,
 909       vmSymbols::java_lang_NoSuchMethodError(),
 910       "%s: method %s%s not found",
 911       resolved_klass->external_name(),
 912       resolved_method->name()->as_C_string(),
 913       resolved_method->signature()->as_C_string()
 914     );
 915     return;
 916   }
 917   
 918   // check if invokespecial's interface method reference is in an indirect superinterface
 919   if (!current_klass.is_null() && resolved_klass->is_interface()) {
 920     Klass *klass_to_check = !InstanceKlass::cast(current_klass())->is_anonymous() ? 
 921                                   current_klass() :
 922                                   InstanceKlass::cast(current_klass())->host_klass();
 923 
 924     if (!InstanceKlass::cast(klass_to_check)->is_same_or_direct_interface(resolved_klass())) {
 925       ResourceMark rm(THREAD);
 926       char buf[200];
 927       jio_snprintf(buf, sizeof(buf),
 928                    "Interface method reference: %s, is in an indirect superinterface of %s",
 929                    Method::name_and_sig_as_C_string(resolved_klass(),
 930                                                          resolved_method->name(),
 931                                                          resolved_method->signature()),
 932                    current_klass->external_name());
 933       THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
 934     }
 935   }
 936 
 937   // check if not static
 938   if (resolved_method->is_static()) {
 939     ResourceMark rm(THREAD);
 940     char buf[200];
 941     jio_snprintf(buf, sizeof(buf),
 942                  "Expecting non-static method %s",
 943                  Method::name_and_sig_as_C_string(resolved_klass(),
 944                                                          resolved_method->name(),
 945                                                          resolved_method->signature()));
 946     THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
 947   }
 948 
 949   if (TraceItables && Verbose) {
 950     ResourceMark rm(THREAD);
 951     tty->print("invokespecial resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
 952                 (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
 953                 (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
 954                 Method::name_and_sig_as_C_string(resolved_klass(),
 955                                                  resolved_method->name(),
 956                                                  resolved_method->signature()),


src/share/vm/interpreter/linkResolver.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File