comparison src/share/vm/oops/klassVtable.cpp @ 17889:386dd1c71858

8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults. Summary: A static method should be preferred during method resolution over an overpass, search the current class as well as its superclasses. Reviewed-by: acorn, coleenp, kamg
author lfoltan
date Mon, 14 Apr 2014 14:27:45 -0400
parents 5832cdaf89c6
children 78bbf4d43a14 364b73402247
comparison
equal deleted inserted replaced
17887:cd3c534f8f4a 17889:386dd1c71858
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
620 // miranda method in the super, whose entry it should re-use. 620 // miranda method in the super, whose entry it should re-use.
621 // Actually, to handle cases that javac would not generate, we need 621 // Actually, to handle cases that javac would not generate, we need
622 // this check for all access permissions. 622 // this check for all access permissions.
623 InstanceKlass *sk = InstanceKlass::cast(super); 623 InstanceKlass *sk = InstanceKlass::cast(super);
624 if (sk->has_miranda_methods()) { 624 if (sk->has_miranda_methods()) {
625 if (sk->lookup_method_in_all_interfaces(name, signature, false) != NULL) { 625 if (sk->lookup_method_in_all_interfaces(name, signature, Klass::normal) != NULL) {
626 return false; // found a matching miranda; we do not need a new entry 626 return false; // found a matching miranda; we do not need a new entry
627 } 627 }
628 } 628 }
629 return true; // found no match; we need a new entry 629 return true; // found no match; we need a new entry
630 } 630 }
696 Method* mo = InstanceKlass::cast(super)->lookup_method(name, signature); 696 Method* mo = InstanceKlass::cast(super)->lookup_method(name, signature);
697 while (mo != NULL && mo->access_flags().is_static() 697 while (mo != NULL && mo->access_flags().is_static()
698 && mo->method_holder() != NULL 698 && mo->method_holder() != NULL
699 && mo->method_holder()->super() != NULL) 699 && mo->method_holder()->super() != NULL)
700 { 700 {
701 mo = mo->method_holder()->super()->uncached_lookup_method(name, signature); 701 mo = mo->method_holder()->super()->uncached_lookup_method(name, signature, Klass::normal);
702 } 702 }
703 if (mo == NULL || mo->access_flags().is_private() ) { 703 if (mo == NULL || mo->access_flags().is_private() ) {
704 // super class hierarchy does not implement it or protection is different 704 // super class hierarchy does not implement it or protection is different
705 return true; 705 return true;
706 } 706 }
741 741
742 if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable 742 if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable
743 if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all? 743 if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all?
744 InstanceKlass *sk = InstanceKlass::cast(super); 744 InstanceKlass *sk = InstanceKlass::cast(super);
745 // check if it is a duplicate of a super's miranda 745 // check if it is a duplicate of a super's miranda
746 if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), false) == NULL) { 746 if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::normal) == NULL) {
747 new_mirandas->append(im); 747 new_mirandas->append(im);
748 } 748 }
749 if (all_mirandas != NULL) { 749 if (all_mirandas != NULL) {
750 all_mirandas->append(im); 750 all_mirandas->append(im);
751 } 751 }