dropwizard-java8
dropwizard-java8 copied to clipboard
Argument factories should be using Class.isAssignableFrom, not instanceof
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.