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

Improved catch analysis fails to handle a common idiom in the libraries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b142
    • CPU:
      unknown
    • OS:
      generic
    • Verification:
      Verified

      Description

      This idiom causes warnings to be generated with latest javac:

                           try {
                               task.run();
                           } catch (RuntimeException x) {
                               thrown = x; throw x;
                           } catch (Error x) {
                               thrown = x; throw x;
                           } catch (Throwable x) {
                               thrown = x; throw new Error(x);
                           } finally {
                               afterExecute(task, thrown);
                           }


      This is a frequent idiom in the JDK - note that the last catch clause is not entirely redundant as it can catch checked exceptions coming from a Class.newInstance call (which is transparent w.r.t. exceptions in the constructor).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mcimadamore Maurizio Cimadamore
              Reporter:
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: