1 /* |
1 /* |
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2018, 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. |
61 } |
61 } |
62 Klass* obj = SystemDictionary::resolve_or_fail( |
62 Klass* obj = SystemDictionary::resolve_or_fail( |
63 name(), Handle(THREAD, klass->class_loader()), |
63 name(), Handle(THREAD, klass->class_loader()), |
64 Handle(THREAD, klass->protection_domain()), true, CHECK_false); |
64 Handle(THREAD, klass->protection_domain()), true, CHECK_false); |
65 KlassHandle this_class(THREAD, obj); |
65 KlassHandle this_class(THREAD, obj); |
66 klass->class_loader_data()->record_dependency(obj, CHECK_false); |
|
67 |
66 |
68 if (this_class->is_interface() && (!from_field_is_protected || |
67 if (this_class->is_interface() && (!from_field_is_protected || |
69 from.name() != vmSymbols::java_lang_Object())) { |
68 from.name() != vmSymbols::java_lang_Object())) { |
70 // If we are not trying to access a protected field or method in |
69 // If we are not trying to access a protected field or method in |
71 // java.lang.Object then we treat interfaces as java.lang.Object, |
70 // java.lang.Object then we treat interfaces as java.lang.Object, |
73 return true; |
72 return true; |
74 } else if (from.is_object()) { |
73 } else if (from.is_object()) { |
75 Klass* from_class = SystemDictionary::resolve_or_fail( |
74 Klass* from_class = SystemDictionary::resolve_or_fail( |
76 from.name(), Handle(THREAD, klass->class_loader()), |
75 from.name(), Handle(THREAD, klass->class_loader()), |
77 Handle(THREAD, klass->protection_domain()), true, CHECK_false); |
76 Handle(THREAD, klass->protection_domain()), true, CHECK_false); |
78 klass->class_loader_data()->record_dependency(from_class, CHECK_false); |
|
79 bool result = InstanceKlass::cast(from_class)->is_subclass_of(this_class()); |
77 bool result = InstanceKlass::cast(from_class)->is_subclass_of(this_class()); |
80 if (result && DumpSharedSpaces) { |
78 if (result && DumpSharedSpaces) { |
81 if (klass()->is_subclass_of(from_class) && klass()->is_subclass_of(this_class())) { |
79 if (klass()->is_subclass_of(from_class) && klass()->is_subclass_of(this_class())) { |
82 // No need to save verification dependency. At run time, <klass> will be |
80 // No need to save verification dependency. At run time, <klass> will be |
83 // loaded from the archived only if <from_class> and <this_class> are |
81 // loaded from the archived only if <from_class> and <this_class> are |