[jdom-interest] Test results for JDOM w/o exceptions

Patrick Dowler Patrick.Dowler at nrc.ca
Mon Jul 10 10:42:48 PDT 2000


On Mon, 10 Jul 2000, you wrote:
> Maybe I'm taking an overly simplistic view of things, but doesn't this
> make sense? Instantiating an object, as in 'throw new FooException()',
> does incur overhead, no? As opposed to 'return null;'?

Yes, with exception throwing you have new/GC for each exception. On top
of that, since you can catch the exception class OR a super-class, the catch
has to check class types for cast-ability. I don't know if this is implemented
using reflection stuff or table lookup (compiler could pre-generate something
for a set of catches, based on what is declared to be thrown), but just matching
the types in catch isn't really trivial - certianly more that assigninh null
and then checking for null...

--

Patrick Dowler
Canadian Astronomy Data Centre




More information about the jdom-interest mailing list