|
From: Liam M. <lm...@wp...> - 2004-12-14 17:52:23
|
Meant to send this to the list, sorry.
-------- Original Message --------
I'm confused, this works just fine (attached). My test case looks like this:
public void testFooBah()
{
Foo foo2 = new Foo();
Bah bah2 = new Bah(foo2.getIntValue());
}
and that fails to compile due to the uncaught exception, but everything
else is fine.
Liam
Gary Pollice wrote:
>What do you mean "everything succeeded?" This should not result in the
>creation of a new Bah because you don't have a valid argument.
>
> --Gary
>
>-----Original Message-----
>From: ebo...@li...
>[mailto:ebo...@li...] On Behalf Of Liam
>Morley
>Sent: Monday, December 13, 2004 3:34 PM
>To: ebo...@li...
>Subject: [EBOB-DISCUSS] what if a constructor argument declares a thrown
>exception?
>
>Let's say we have a class Foo:
>
>Class Foo {
> int getIntValue() throws Exception {
> return 4;
> }
>}
>
>and a class Bah:
>
>Class Bah {
> Bah (int i) {}
>}
>
>What if we add a Foo object to the bench "foo1", and then try to add a Bah
>object to the bench using "foo1.getIntValue()" as a parameter in the
>constructor? Java would say we need to catch that exception somewhere, but
>where?
>
>I tried this in BlueJ... Everything succeeded, and I wasn't alerted to the
>uncaught Exception. I recorded a Unit test, which succeeded; however, when I
>opened the unit test and tried to compile it, it failed.
>
>Liam
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide Read honest & candid reviews
>on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Ebob-discussion mailing list
>Ebo...@li...
>https://lists.sourceforge.net/lists/listinfo/ebob-discussion
>
>
>
>
>
>
>
|