src/share/vm/interpreter/linkResolver.cpp

changeset 6195
5832cdaf89c6
parent 6167
9fbabcbb875b
child 6232
1a023fd29afb
child 6818
096a7e12d63f
     1.1 --- a/src/share/vm/interpreter/linkResolver.cpp	Fri Dec 13 09:48:29 2013 -0800
     1.2 +++ b/src/share/vm/interpreter/linkResolver.cpp	Mon Dec 16 08:24:33 2013 -0500
     1.3 @@ -300,7 +300,7 @@
     1.4    Symbol* signature = resolved_method->signature();
     1.5  
     1.6    // First check in default method array
     1.7 -  if (!resolved_method->is_abstract()  &&
     1.8 +  if (!resolved_method->is_abstract() &&
     1.9      (InstanceKlass::cast(klass())->default_methods() != NULL)) {
    1.10      int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), name, signature);
    1.11      if (index >= 0 ) {
    1.12 @@ -318,7 +318,11 @@
    1.13  
    1.14  void LinkResolver::lookup_method_in_interfaces(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
    1.15    InstanceKlass *ik = InstanceKlass::cast(klass());
    1.16 -  result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature));
    1.17 +
    1.18 +  // Specify 'true' in order to skip default methods when searching the
    1.19 +  // interfaces.  Function lookup_method_in_klasses() already looked for
    1.20 +  // the method in the default methods table.
    1.21 +  result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature, true));
    1.22  }
    1.23  
    1.24  void LinkResolver::lookup_polymorphic_method(methodHandle& result,
    1.25 @@ -620,7 +624,7 @@
    1.26                                              bool check_access,
    1.27                                              bool nostatics, TRAPS) {
    1.28  
    1.29 - // check if klass is interface
    1.30 +  // check if klass is interface
    1.31    if (!resolved_klass->is_interface()) {
    1.32      ResourceMark rm(THREAD);
    1.33      char buf[200];
    1.34 @@ -1287,8 +1291,11 @@
    1.35                   resolved_klass()->external_name());
    1.36      THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
    1.37    }
    1.38 +
    1.39    // do lookup based on receiver klass
    1.40    methodHandle sel_method;
    1.41 +  // This search must match the linktime preparation search for itable initialization
    1.42 +  // to correctly enforce loader constraints for interface method inheritance
    1.43    lookup_instance_method_in_klasses(sel_method, recv_klass,
    1.44              resolved_method->name(),
    1.45              resolved_method->signature(), CHECK);

mercurial