69
70 if (this_class->is_interface() && (!from_field_is_protected ||
71 from.name() != vmSymbols::java_lang_Object())) {
72 // If we are not trying to access a protected field or method in
73 // java.lang.Object then we treat interfaces as java.lang.Object,
74 // including java.lang.Cloneable and java.io.Serializable.
75 return true;
76 } else if (from.is_object()) {
77 Klass* from_class = SystemDictionary::resolve_or_fail(
78 from.name(), Handle(THREAD, klass->class_loader()),
79 Handle(THREAD, klass->protection_domain()), true, CHECK_false);
80 if (TraceClassResolution) {
81 Verifier::trace_class_resolution(from_class, klass());
82 }
83 return InstanceKlass::cast(from_class)->is_subclass_of(this_class());
84 }
85 } else if (is_array() && from.is_array()) {
86 VerificationType comp_this = get_component(context, CHECK_false);
87 VerificationType comp_from = from.get_component(context, CHECK_false);
88 if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
89 return comp_this.is_assignable_from(comp_from, context,
90 from_field_is_protected, CHECK_false);
91 }
92 }
93 return false;
94 }
95
96 VerificationType VerificationType::get_component(ClassVerifier *context, TRAPS) const {
97 assert(is_array() && name()->utf8_length() >= 2, "Must be a valid array");
98 Symbol* component;
99 switch (name()->byte_at(1)) {
100 case 'Z': return VerificationType(Boolean);
101 case 'B': return VerificationType(Byte);
102 case 'C': return VerificationType(Char);
103 case 'S': return VerificationType(Short);
104 case 'I': return VerificationType(Integer);
105 case 'J': return VerificationType(Long);
106 case 'F': return VerificationType(Float);
107 case 'D': return VerificationType(Double);
108 case '[':
109 component = context->create_temporary_symbol(
|
69
70 if (this_class->is_interface() && (!from_field_is_protected ||
71 from.name() != vmSymbols::java_lang_Object())) {
72 // If we are not trying to access a protected field or method in
73 // java.lang.Object then we treat interfaces as java.lang.Object,
74 // including java.lang.Cloneable and java.io.Serializable.
75 return true;
76 } else if (from.is_object()) {
77 Klass* from_class = SystemDictionary::resolve_or_fail(
78 from.name(), Handle(THREAD, klass->class_loader()),
79 Handle(THREAD, klass->protection_domain()), true, CHECK_false);
80 if (TraceClassResolution) {
81 Verifier::trace_class_resolution(from_class, klass());
82 }
83 return InstanceKlass::cast(from_class)->is_subclass_of(this_class());
84 }
85 } else if (is_array() && from.is_array()) {
86 VerificationType comp_this = get_component(context, CHECK_false);
87 VerificationType comp_from = from.get_component(context, CHECK_false);
88 if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
89 return comp_this.is_component_assignable_from(comp_from, context,
90 from_field_is_protected, CHECK_false);
91 }
92 }
93 return false;
94 }
95
96 VerificationType VerificationType::get_component(ClassVerifier *context, TRAPS) const {
97 assert(is_array() && name()->utf8_length() >= 2, "Must be a valid array");
98 Symbol* component;
99 switch (name()->byte_at(1)) {
100 case 'Z': return VerificationType(Boolean);
101 case 'B': return VerificationType(Byte);
102 case 'C': return VerificationType(Char);
103 case 'S': return VerificationType(Short);
104 case 'I': return VerificationType(Integer);
105 case 'J': return VerificationType(Long);
106 case 'F': return VerificationType(Float);
107 case 'D': return VerificationType(Double);
108 case '[':
109 component = context->create_temporary_symbol(
|