diff 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
line wrap: on
line diff
--- a/src/share/vm/opto/type.cpp	Thu Dec 03 14:20:22 2009 -0800
+++ b/src/share/vm/opto/type.cpp	Thu Jan 21 10:07:59 2010 -0800
@@ -2545,12 +2545,15 @@
       ftip->is_loaded() &&  ftip->klass()->is_interface() &&
       ktip->is_loaded() && !ktip->klass()->is_interface()) {
     // Happens in a CTW of rt.jar, 320-341, no extra flags
+    assert(!ftip->klass_is_exact(), "interface could not be exact");
     return ktip->cast_to_ptr_type(ftip->ptr());
   }
+  // Interface klass type could be exact in opposite to interface type,
+  // return it here instead of incorrect Constant ptr J/L/Object (6894807).
   if (ftkp != NULL && ktkp != NULL &&
       ftkp->is_loaded() &&  ftkp->klass()->is_interface() &&
+      !ftkp->klass_is_exact() && // Keep exact interface klass
       ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
-    // Happens in a CTW of rt.jar, 320-341, no extra flags
     return ktkp->cast_to_ptr_type(ftkp->ptr());
   }