comparison src/share/vm/classfile/verifier.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 22eaa15b7960
children 78bbf4d43a14 364b73402247
comparison
equal deleted inserted replaced
17887:cd3c534f8f4a 17889:386dd1c71858
1 /* 1 /*
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 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.
1941 } 1941 }
1942 // Check if the specified method or field is protected 1942 // Check if the specified method or field is protected
1943 InstanceKlass* target_instance = InstanceKlass::cast(target_class); 1943 InstanceKlass* target_instance = InstanceKlass::cast(target_class);
1944 fieldDescriptor fd; 1944 fieldDescriptor fd;
1945 if (is_method) { 1945 if (is_method) {
1946 Method* m = target_instance->uncached_lookup_method(field_name, field_sig); 1946 Method* m = target_instance->uncached_lookup_method(field_name, field_sig, Klass::normal);
1947 if (m != NULL && m->is_protected()) { 1947 if (m != NULL && m->is_protected()) {
1948 if (!this_class->is_same_class_package(m->method_holder())) { 1948 if (!this_class->is_same_class_package(m->method_holder())) {
1949 return true; 1949 return true;
1950 } 1950 }
1951 } 1951 }
2278 if (name_in_supers(ref_class_type.name(), current_class())) { 2278 if (name_in_supers(ref_class_type.name(), current_class())) {
2279 Klass* ref_klass = load_class( 2279 Klass* ref_klass = load_class(
2280 ref_class_type.name(), CHECK_VERIFY(this)); 2280 ref_class_type.name(), CHECK_VERIFY(this));
2281 Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method( 2281 Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method(
2282 vmSymbols::object_initializer_name(), 2282 vmSymbols::object_initializer_name(),
2283 cp->signature_ref_at(bcs->get_index_u2())); 2283 cp->signature_ref_at(bcs->get_index_u2()),
2284 Klass::normal);
2284 instanceKlassHandle mh(THREAD, m->method_holder()); 2285 instanceKlassHandle mh(THREAD, m->method_holder());
2285 if (m->is_protected() && !mh->is_same_class_package(_klass())) { 2286 if (m->is_protected() && !mh->is_same_class_package(_klass())) {
2286 bool assignable = current_type().is_assignable_from( 2287 bool assignable = current_type().is_assignable_from(
2287 objectref_type, this, CHECK_VERIFY(this)); 2288 objectref_type, this, CHECK_VERIFY(this));
2288 if (!assignable) { 2289 if (!assignable) {