What on earth is “Self-suppression not permitted” and why is Javac generating code which results in this error?
问题 This new Java 7 try-with-resources construct is quite nice. Or at least, it was nice until an exception came along and ruined my day. I've finally managed to boil it down to a reproducible test which uses nothing but JUnit+jMock. @Test public void testAddSuppressedIssue() throws Exception { Mockery mockery = new Mockery(); final Dependency dependency = mockery.mock(Dependency.class); mockery.checking(new Expectations() {{ allowing(dependency).expectedCall(); allowing(dependency).close(); }});