Rounding error when having a BigDecimal at runtime with @Max/@Min annotation set on a Number field

Description

I think I might have found a oddity in hibernate-validator 6.0.15.Final. It used to work with the version 5.4.2.Final.

Here is a test example:

The BigDecimal stored in a Number field will not trigger a constraint exception even though it is bigger than 1. And a bigdecimal such as 2.xxx would.

It feels like the validator does not (anymore) take into account the numbers after the comma in BigDecimals objects stored in a Number.

Environment

java version "1.8.0_201"
Windows 10

Status

Assignee

Marko Bekhta

Reporter

Arnaud Villevieille

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

6.0.15.Final

Priority

Major
Configure