Hi,

I saw the following pattern repeated in the Oak codebase:

  checkArgument(foo instanceOf IFoo);
  IFoo iFoo = (IFoo) foo;

I am not sure that the value of the checkArgument call is. If it fails,
the root cause will be an IllegalArgumentException with no message. On
the other hand, if we let the ClassCastException happen, it will have
an explicit message such as

  com.foo.NotFoo cannot be cast to com.foo.IFoo

Is there a specific reason for this pattern?

Thanks,

Robert

Reply via email to