Skip to content
This repository has been archived by the owner on Mar 3, 2019. It is now read-only.

Argument factories should be using Class.isAssignableFrom, not instanceof #23

Open
qualidafial opened this issue Nov 24, 2015 · 0 comments

Comments

@qualidafial
Copy link

instanceof is always false for null, which means the argument factory misses a chance to provide the correct SQL type.

These factories should be using e.g. Foo.class.isAssignableFrom(expectedType) instead of value instanceof Foo:

  • InstantArgumentFactory
  • LocalDateArgumentFactory
  • LocalDateTimeArgumentFactory
  • OptionalArgumentFactory
  • OptionalInstantArgumentFactory
  • OptionalLocalDateArgumentFactory
  • OptionalLocalDateTimeArgumentFactory

Although the optional ones are arguably moot, since one should never pass null to a method that expects an optional.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant