Making a control API swallow an exception...
Jonathan Gibbons
Jonathan.Gibbons at Sun.COM
Sun May 4 15:17:29 PDT 2008
Neal,
FYI, regression tests generally need a plain GPL2 copyright. See other
tests for an example. The primary exception for compiler tests is
tests which use "@compile -XDrawDiagnostics", meaning the line numbers
in the file are significant. For such tests, you should put the
string "/nodynamiccopyright/" after @test, on the same line.
-- Jon
On May 4, 2008, at 2:41 PM, Neal Gafter wrote:
> FYI: I've initialzed the closures mercurial forest from the tl forest.
> None of my changes are included yet.
>
> I'm adding the following to my set of unit tests, so it will be
> included when I've completed pushing the closures changes. I've
> pushed a binary prototype that properly handles this case.
>
> /*
> * @test
> * @summary Check that APIs can be defined to swallow exceptions
> * @author gafter
> *
> * @clean Swallow
> * @compile -source 7 Swallow.java
> * @run main Swallow
> */
>
> import java.io.*;
>
> public class Swallow {
> static <throws X> void swallow1({ ==> void throws X, IOException}
> block) throws X {
> try {
> block.invoke();
> } catch (IOException ex) {
> }
> }
> static <throws X> void swallow2({ ==> void throws IOException, X}
> block) throws X {
> try {
> block.invoke();
> } catch (IOException ex) {
> }
> }
> public static void main(String[] args) {
> java.io.Closeable c = { => throw new IOException(); };
> swallow1() { c.close(); }
> swallow2() { c.close(); }
> }
> }
More information about the closures-dev
mailing list