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

ClassCastExceptions not caught by Symantec

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1.6
    • 1.1.5
    • vm-legacy
    • 1.1.6
    • x86
    • windows_nt
    • Verified

      The Symantec JIT seems not to like ClassCastExceptions. Below is a sample

      program that throws and catches a ClassCastException (prompt 1). With plain
      JDK1.1.5 the exception is thrown and caught correctly (prompt 3). With the
      addition of the Symantec 300b015 JIT, the program throws the
      ClassCastException, but instead of being caught, it terminates the program
      (with no backtrace!) (prompt 4). I also tried this program on 300b012, and
      got the same results.

      Taking out the loop removes the problem. Changing the loop to an if removes the
      problem. So I think this is a localized bug, not a general failure to catch
      exceptions.

      peter.kessler@Eng 1998-01-28

      -------------------------------------------------------------------------------

      Microsoft(R) Windows NT(TM)
      (C) Copyright 1985-1996 Microsoft Corp.

      1> type ..\java\ClassCaster.java
      public class ClassCaster {
          public static void main(String[] args) {
              invalidCastTest();
          }
          public static void invalidCastTest() {
              Base instance = new Base();
              int left = 23;
              int right = 42;
              try {
                  for (int i = 0; i < 1; i += 1) {
                      left = ((Derived) instance).method(left, right);
                  }
                  System.out.println("Unhappy");
              } catch (ClassCastException cce) {
                  System.out.println("Happy");
              }
          }
      }

      class Base {
          public int method(int left, int right) {
              return left;
          }
      }
      class Derived extends Base {
          public int method(int left, int right) {
              return right;
          }
      }

      2> d:\jdk1.1.5\bin\javac -d . ..\java\ClassCaster.java

      3> d:\jdk1.1.5\bin\java ClassCaster
      Happy

      4> d:\jdk1.1.5-Symantec3.0\bin\java ClassCaster
      Symantec Java! JustInTime Compiler Version i300.015 for JDK 1.1.x
      Copyright (C) 1996-98 Symantec Corporation

      java.lang.ClassCastException

            dviswanasunw Deepa Viswanathan (Inactive)
            pbk Peter Kessler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: