rvesse / airline

Java annotation-based framework for parsing Git like command line structures with deep extensibility
https://rvesse.github.io/airline/
Apache License 2.0
128 stars 20 forks source link

When numeric range restriction is too narrow a type for field type unhelpful errors are issued #120

Open rvesse opened 2 years ago

rvesse commented 2 years ago

Discovered from $day job testing. When using a numeric range restriction eg IntegerRange on a field with a wider type eg long what looks like a valid value can be rejected with an unhelpful error:

Value for option 'MaxIdleTime' was given as '2' which is not in the acceptable range: value >= 1

This is because while the range restriction implementation copes with widening casts eg LongRange on an int field it doesn't cope with the inverse.

Implementation should be improved to issue a more specific error in this case since this is an option definition error