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

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 7
    • Affects Version/s: 7
    • Component/s: 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).

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: