comparison src/share/vm/opto/type.cpp @ 1335:ae4032fb0a5b

6894807: No ClassCastException for HashAttributeSet constructors if run with -Xcomp Summary: Return interface klass type if it is exact. Reviewed-by: never
author kvn
date Thu, 21 Jan 2010 10:07:59 -0800
parents 03b336640699
children 09ac706c2623
comparison
equal deleted inserted replaced
1334:b5d78a3b8843 1335:ae4032fb0a5b
2543 // because the type system doesn't interact well with interfaces. 2543 // because the type system doesn't interact well with interfaces.
2544 if (ftip != NULL && ktip != NULL && 2544 if (ftip != NULL && ktip != NULL &&
2545 ftip->is_loaded() && ftip->klass()->is_interface() && 2545 ftip->is_loaded() && ftip->klass()->is_interface() &&
2546 ktip->is_loaded() && !ktip->klass()->is_interface()) { 2546 ktip->is_loaded() && !ktip->klass()->is_interface()) {
2547 // Happens in a CTW of rt.jar, 320-341, no extra flags 2547 // Happens in a CTW of rt.jar, 320-341, no extra flags
2548 assert(!ftip->klass_is_exact(), "interface could not be exact");
2548 return ktip->cast_to_ptr_type(ftip->ptr()); 2549 return ktip->cast_to_ptr_type(ftip->ptr());
2549 } 2550 }
2551 // Interface klass type could be exact in opposite to interface type,
2552 // return it here instead of incorrect Constant ptr J/L/Object (6894807).
2550 if (ftkp != NULL && ktkp != NULL && 2553 if (ftkp != NULL && ktkp != NULL &&
2551 ftkp->is_loaded() && ftkp->klass()->is_interface() && 2554 ftkp->is_loaded() && ftkp->klass()->is_interface() &&
2555 !ftkp->klass_is_exact() && // Keep exact interface klass
2552 ktkp->is_loaded() && !ktkp->klass()->is_interface()) { 2556 ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
2553 // Happens in a CTW of rt.jar, 320-341, no extra flags
2554 return ktkp->cast_to_ptr_type(ftkp->ptr()); 2557 return ktkp->cast_to_ptr_type(ftkp->ptr());
2555 } 2558 }
2556 2559
2557 return ft; 2560 return ft;
2558 } 2561 }