src/share/vm/classfile/verificationType.hpp

changeset 6824
2373a1f4987c
parent 3992
4ee06e614636
child 6830
54bc75c144b0
equal deleted inserted replaced
6823:21444610cb92 6824:2373a1f4987c
1 /* 1 /*
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 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.
263 263
264 // The whole point of this type system - check to see if one type 264 // The whole point of this type system - check to see if one type
265 // is assignable to another. Returns true if one can assign 'from' to 265 // is assignable to another. Returns true if one can assign 'from' to
266 // this. 266 // this.
267 bool is_assignable_from( 267 bool is_assignable_from(
268 const VerificationType& from, ClassVerifier* context, TRAPS) const { 268 const VerificationType& from, ClassVerifier* context,
269 bool from_field_is_protected, TRAPS) const {
269 if (equals(from) || is_bogus()) { 270 if (equals(from) || is_bogus()) {
270 return true; 271 return true;
271 } else { 272 } else {
272 switch(_u._data) { 273 switch(_u._data) {
273 case Category1Query: 274 case Category1Query:
284 case Short: 285 case Short:
285 // An int can be assigned to boolean, byte, char or short values. 286 // An int can be assigned to boolean, byte, char or short values.
286 return from.is_integer(); 287 return from.is_integer();
287 default: 288 default:
288 if (is_reference() && from.is_reference()) { 289 if (is_reference() && from.is_reference()) {
289 return is_reference_assignable_from(from, context, CHECK_false); 290 return is_reference_assignable_from(from, context,
291 from_field_is_protected,
292 CHECK_false);
290 } else { 293 } else {
291 return false; 294 return false;
292 } 295 }
293 } 296 }
294 } 297 }
306 void print_on(outputStream* st) const; 309 void print_on(outputStream* st) const;
307 310
308 private: 311 private:
309 312
310 bool is_reference_assignable_from( 313 bool is_reference_assignable_from(
311 const VerificationType&, ClassVerifier*, TRAPS) const; 314 const VerificationType&, ClassVerifier*, bool from_field_is_protected,
315 TRAPS) const;
312 }; 316 };
313 317
314 #endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP 318 #endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP

mercurial