[
https://issues.apache.org/jira/browse/GROOVY-4662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Sun reassigned GROOVY-4662:
----------------------------------
Fix Version/s: 7.0.0-alpha-1
Assignee: Daniel Sun
> Closures leak InvokerInvocationException to Java callers
> --------------------------------------------------------
>
> Key: GROOVY-4662
> URL: https://issues.apache.org/jira/browse/GROOVY-4662
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 1.7.7
> Reporter: Peter Niederwieser
> Assignee: Daniel Sun
> Priority: Major
> Fix For: 7.0.0-alpha-1
>
>
> GroovyLib.groovy:
> {code}
> class GroovyLib {
> void boom() throws IOException { throw new IOException() }
> void undeclaredBoom() { throw new IOException() }
> Closure closure = { throw new IOException() }
> Runnable runnable = { throw new IOException() }
> }
> {code}
> GroovyJavaExceptionPropagationTest.java:
> {code}
> public class GroovyJavaExceptionPropagationTest {
> @Test(expected = IOException.class)
> public void callGroovyMethodThatThrowsDeclaredCheckedException() throws
> Exception {
> new GroovyLib().boom(); // throws IOException
> }
> @Test(expected = IOException.class)
> public void callGroovyMethodThatThrowsUndeclaredCheckedException() throws
> Exception {
> new GroovyLib().undeclaredBoom(); // throws IOException
> }
> @Test(expected = IOException.class)
> public void callGroovyClosureThatThrowsCheckedException() throws Exception {
> new GroovyLib().getClosure().call(); // throws InvokerInvocationException
> }
> @Test(expected = IOException.class)
> public void
> callGroovyClosureDisguisedAsRunnableThatThrowsCheckedException() throws
> Exception {
> new GroovyLib().getRunnable().run(); // throws InvokerInvocationException
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)