Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4826718

REGRESSION: ClassCastException no longer reveals the runtime type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • 1.4.1
    • hotspot
    • tiger
    • x86
    • windows_2000



      Name: nt126004 Date: 03/03/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      FULL OS VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      Since J2SE 1.4.1 the ClassCastException no longer reveals the runtime type of the casted object.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Cast an Integer to a String
      2. Have a look at the StackTrace

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      java.lang.ClassCastException: java.lang.Integer
      java.lang.ClassCastException

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Test {
          public static void main(String[] args) {
      Object i = new Integer(0);
              String s = (String)i;
          }
      }
      ---------- END SOURCE ----------

      Release Regression From : 1.4
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 181924)
      ======================================================================

            jrose John Rose
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: