Disambiguating empty catch blocks
Mario Torre
mario.torre at aicas.com
Wed Apr 14 11:26:38 UTC 2010
Il giorno mer, 14/04/2010 alle 22.49 +1200, Bruce Chapman ha scritto:
> Thanks Martin,
>
> comment inline.
>
> Bruce
>
>
> Martin Buchholz wrote:
> > Hi Bruce,
> >
> > I don't think you're going to find enough support for adding
> > rarely used new methods to existing exception classes.
> >
> Of course it is rare at present - it doesn't yet exist. So "rarely used"
> is at this point subjective and hypothetical. My feeling is that it
> would be useful, if you think not, then that is another data point.
> Maybe a weekly survey question for java.net? - I am sure they could
> find a way to turn it into 5 choices. :)
> > There's already a clear way to indicate to human readers
> > that an exception should be ignored or is expected
> >
> > catch (SomeException ignored) { }
> >
> > catch (SomeException expected) { }
> >
>
> Oh dear, I thought we had finally got away from "magic name" solutions.
> Of course in JDK7 we'll be able to
>
> catch (@Ignored SomeException ex) { }
>
> catch (@Impossible SomeException ex) { }
It think I like this one.
I also used
catch (SomeException _) { /* ignored */ }
The _ is a clear sign. If you don't name it, it means you're not
interested in it, and the comment is purely optional then.
Cheers,
Mario
--
Mario Torre, Software Developer, http://www.jroller.com/neugens/
aicas GmbH, Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Mannheim
Geschäftsführer: Dr. James J. Hunt
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF
Please, support open standards: http://endsoftpatents.org/
More information about the core-libs-dev
mailing list