On Monday 29 April 2013 07:13 PM, David M. Lloyd wrote:
On 04/27/2013 10:10 PM, Jaikiran Pai wrote:
> On Saturday 27 April 2013 09:11 PM, James R. Perkins wrote:
>> Not that wouldn't work. Each invocation of fooBar() will return a new
>> instance of SomeException.
> Ok. I thought that for no param messages the return type would be cached
> and reused.
Exceptions capture a new stack trace for each instantiation, so they're
not often equal even if their inputs all seem equal.
I wasn't aware of that. I thought the stack trace collection would
happen at the point where it's being thrown and not when an exception is
being instantiated. Now that you and Kabir mentioned it, I went and had
a look at the Throwable javadoc and it does clearly state this.Thanks!
-Jaikiran