Last active
October 18, 2016 13:29
-
-
Save udoprog/e6b2efcf7fb6da13cb7ffacb12edebcc to your computer and use it in GitHub Desktop.
Case where non-final is OK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Main { | |
| public static void main(String[] argv) throws Exception { | |
| Exception e = null; | |
| try { | |
| doSomething(); | |
| } catch(final Exception inner) { | |
| e = inner; | |
| } | |
| try { | |
| doSometingElse(); | |
| } catch(final Exception inner) { | |
| if (e != null) { | |
| inner.addSuppressed(e); | |
| } | |
| e = inner; | |
| } | |
| if (e != null) { | |
| throw e; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment