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

unreachable catch blocks are not detected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • tools
    • generic
    • generic

      The following compiles without error in both 1.2 and 1.3-L.
      According to JLS 14.19, the catch blocks are unreachable.

      public class Bug {

          void test() {

      int state = 0;
      try {
      // empty try cannot generate Exceptions !
      }
      catch (ArithmeticException e) {
      state = 1;
      }
      catch (Exception e) {
      state = 2;
      }
          }
      }

            wmaddoxsunw William Maddox (Inactive)
            wmaddoxsunw William Maddox (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: