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

missing warn about exception not thrown in try block if finally can't complete

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.4.1
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      hopper
    • CPU:
      generic
    • OS:
      solaris_8
    • Verification:
      Verified

      Description

      The following program should not compile because the exception caught
      in the catch block cannot be thrown by the try block. javac 1.3 and
      later fails to diagnose this problem. This is a regression from previous
      versions of the compiler.

      class T {
          static class E extends Exception {}

          public void t() throws E {}

          void f() {
              try {
                  try {
                      t();
                  } finally {
                      return;
                  }
              } catch (E x) { // error: E can't be thrown in try block
              }
          }
      }

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: