On Nov 29, 2007, at 4:52 PM, Tim Peierls wrote:
Abstractly, though, would you rather see ReferenceBuilderException checked or unchecked in the following:try {Reference ref = ReferenceBuilder.appendBar("myBar").appendFoo("myFoo");// do something with ref } catch (ReferenceBuilderException e) { // myBad: foo must come before bar // clean up // ? throw e; } Programmer was wrong -- this should be unchecked, right?
How do you know the programmer was wrong? How does the implementor of ReferenceBuilder know whether the data was supplied by the programmer or the user of the program? If the latter, it's the user who is wrong in which case the programmer must deal with that. Therefore: checked exception.
In general, IMHO, you've got to have a really, really good reason to make an exception unchecked. "Because it's easier" isn't a good reason.
- Paul

