1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
681 if (m->is_static() || m->is_private() || m->is_overpass()) {
682 return false;
683 }
684 Symbol* name = m->name();
685 Symbol* signature = m->signature();
686
687 if (InstanceKlass::find_instance_method(class_methods, name, signature) == NULL) {
688 // did not find it in the method table of the current class
689 if ((default_methods == NULL) ||
690 InstanceKlass::find_method(default_methods, name, signature) == NULL) {
691 if (super == NULL) {
692 // super doesn't exist
693 return true;
694 }
695
696 Method* mo = InstanceKlass::cast(super)->lookup_method(name, signature);
697 while (mo != NULL && mo->access_flags().is_static()
698 && mo->method_holder() != NULL
699 && mo->method_holder()->super() != NULL)
700 {
701 mo = mo->method_holder()->super()->uncached_lookup_method(name, signature);
702 }
703 if (mo == NULL || mo->access_flags().is_private() ) {
704 // super class hierarchy does not implement it or protection is different
705 return true;
706 }
707 }
708 }
709
710 return false;
711 }
712
713 // Scans current_interface_methods for miranda methods that do not
714 // already appear in new_mirandas, or default methods, and are also not defined-and-non-private
715 // in super (superclass). These mirandas are added to all_mirandas if it is
716 // not null; in addition, those that are not duplicates of miranda methods
717 // inherited by super from its interfaces are added to new_mirandas.
718 // Thus, new_mirandas will be the set of mirandas that this class introduces,
719 // all_mirandas will be the set of all mirandas applicable to this class
720 // including all defined in superclasses.
721 void klassVtable::add_new_mirandas_to_lists(
|
1 /*
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.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
681 if (m->is_static() || m->is_private() || m->is_overpass()) {
682 return false;
683 }
684 Symbol* name = m->name();
685 Symbol* signature = m->signature();
686
687 if (InstanceKlass::find_instance_method(class_methods, name, signature) == NULL) {
688 // did not find it in the method table of the current class
689 if ((default_methods == NULL) ||
690 InstanceKlass::find_method(default_methods, name, signature) == NULL) {
691 if (super == NULL) {
692 // super doesn't exist
693 return true;
694 }
695
696 Method* mo = InstanceKlass::cast(super)->lookup_method(name, signature);
697 while (mo != NULL && mo->access_flags().is_static()
698 && mo->method_holder() != NULL
699 && mo->method_holder()->super() != NULL)
700 {
701 mo = mo->method_holder()->super()->uncached_lookup_method(name, signature, false);
702 }
703 if (mo == NULL || mo->access_flags().is_private() ) {
704 // super class hierarchy does not implement it or protection is different
705 return true;
706 }
707 }
708 }
709
710 return false;
711 }
712
713 // Scans current_interface_methods for miranda methods that do not
714 // already appear in new_mirandas, or default methods, and are also not defined-and-non-private
715 // in super (superclass). These mirandas are added to all_mirandas if it is
716 // not null; in addition, those that are not duplicates of miranda methods
717 // inherited by super from its interfaces are added to new_mirandas.
718 // Thus, new_mirandas will be the set of mirandas that this class introduces,
719 // all_mirandas will be the set of all mirandas applicable to this class
720 // including all defined in superclasses.
721 void klassVtable::add_new_mirandas_to_lists(
|