hotspot/src/share/vm/classfile/verifier.cpp
changeset 23999 22eb7be3d99d
parent 21768 b7dba4cde1c6
child 24322 c2978d1578e3
equal deleted inserted replaced
23998:418ac4fe9834 23999:22eb7be3d99d
     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) {