Making a control API swallow an exception...

Neal Gafter neal at gafter.com
Sun May 4 15:30:54 PDT 2008


All the tests will be under GPL2 copyright when committed to the
openjdk repository.  I removed the copyright headers in the email for
clarity.

On Sun, May 4, 2008 at 3:17 PM, Jonathan Gibbons
<Jonathan.Gibbons at sun.com> wrote:
> 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