Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Incomplete
-
1.7.10
-
None
-
None
-
None
-
JDK 1.6
Description
// Java delegate class public class TheDelegate { public void setDelegatesPropertyThrowsException(Object value) throws javax.mail.internet.AddressException { throw new AddressException("Just an example."); } } // the closure call (Java) public void methodThatTakesAClosure(Closure cl) { final TheDelegate delegate = new TheDelegate(); // ... closure = (Closure)cl.clone(); closure.setResolveStrategy(Closure.DELEGATE_FIRST); closure.setDelegate(delegate); closure.call(delegate); // no exception is seen here // ... }
The following script does not get the exception thrown by setDelegatesPropertyThrowsException.
// Groovy script thing.methodThatTakesAClosure { delegatesPropertyThrowsException = "tryThis" } assert delegatesPropertyThrowsException == "tryThis" // this was the MOP's second try