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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • 7
    • 7
    • tools
    • b142
    • unknown
    • generic
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: