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

missing catch not reachable error when nested try-finally returns in finally

    XMLWordPrintable

Details

    • mantis
    • generic
    • solaris_8

    Description

      The following program should compile with an error. Instead, javac allows it.
      /*
       * @test @(#)T4717164.java 1.1 02/07/23
       * @bug 4717164
       * @summary missing catch not reachable error when nested try-finally returns in finally
       * @author Neal Gafter (gafter)
       *
       * @compile/fail T4717164.java
       */

      class T4717164 {
          public static void main(String[] args) {
              try {
                  try {
                      throw new ClassNotFoundException();
                  } catch (ClassNotFoundException e) {
                      throw e;
                  } finally {
                      return; // discards ClassNotFoundException
                  }
              } catch (ClassNotFoundException e1) { // error: unreachable
              }
          }
      }




      Attachments

        Activity

          People

            gafter Neal Gafter
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: