Hi,

On 6.9.12 13:51, Jukka Zitting wrote:
Hi,

On Thu, Sep 6, 2012 at 2:36 PM, Marcel Reutegger <[email protected]> wrote:
I think we need to throw an exception in this case. IllegalArgumentException?

This shouldn't be an assertion agreed.


Agreed in general. I've already encountered a few cases where a test
case runs just fine in Eclipse (without assertions enabled) but then
fails during the Maven build (which enables assertions). It would be
better if such failsafes were executed always unless they're too
expensive to compute in normal operation.

The precondition feature [1] in Guava is a pretty nice way to
implement such checks.

+1 for using the precondition feature.

One notable exception might be PathUtils where the precondition check might turn out to be quite expensive. So I think we should keep the assertions there.

Michael



[1] http://code.google.com/p/guava-libraries/wiki/PreconditionsExplained

BR,

Jukka Zitting

Reply via email to