52 // We need check the class hierarchy to check assignability |
52 // We need check the class hierarchy to check assignability |
53 if (name() == vmSymbols::java_lang_Object()) { |
53 if (name() == vmSymbols::java_lang_Object()) { |
54 // any object or array is assignable to java.lang.Object |
54 // any object or array is assignable to java.lang.Object |
55 return true; |
55 return true; |
56 } |
56 } |
57 klassOop this_class = SystemDictionary::resolve_or_fail( |
57 klassOop obj = SystemDictionary::resolve_or_fail( |
58 name_handle(), Handle(THREAD, context->class_loader()), |
58 name_handle(), Handle(THREAD, context->class_loader()), |
59 Handle(THREAD, context->protection_domain()), true, CHECK_false); |
59 Handle(THREAD, context->protection_domain()), true, CHECK_false); |
60 if (this_class->klass_part()->is_interface()) { |
60 KlassHandle this_class(THREAD, obj); |
|
61 |
|
62 if (this_class->is_interface()) { |
61 // We treat interfaces as java.lang.Object, including |
63 // We treat interfaces as java.lang.Object, including |
62 // java.lang.Cloneable and java.io.Serializable |
64 // java.lang.Cloneable and java.io.Serializable |
63 return true; |
65 return true; |
64 } else if (from.is_object()) { |
66 } else if (from.is_object()) { |
65 klassOop from_class = SystemDictionary::resolve_or_fail( |
67 klassOop from_class = SystemDictionary::resolve_or_fail( |
66 from.name_handle(), Handle(THREAD, context->class_loader()), |
68 from.name_handle(), Handle(THREAD, context->class_loader()), |
67 Handle(THREAD, context->protection_domain()), true, CHECK_false); |
69 Handle(THREAD, context->protection_domain()), true, CHECK_false); |
68 return instanceKlass::cast(from_class)->is_subclass_of(this_class); |
70 return instanceKlass::cast(from_class)->is_subclass_of(this_class()); |
69 } |
71 } |
70 } else if (is_array() && from.is_array()) { |
72 } else if (is_array() && from.is_array()) { |
71 VerificationType comp_this = get_component(CHECK_false); |
73 VerificationType comp_this = get_component(CHECK_false); |
72 VerificationType comp_from = from.get_component(CHECK_false); |
74 VerificationType comp_from = from.get_component(CHECK_false); |
73 if (!comp_this.is_bogus() && !comp_from.is_bogus()) { |
75 if (!comp_this.is_bogus() && !comp_from.is_bogus()) { |