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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 7
    • 7
    • tools
    • b142
    • unknown
    • generic
    • Verified

      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).

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: