Wen trying to validate a pretty large list of beans, I sometimes encounter a ClassCastException in the ValidationException.isAlreadyValidatedForCurrentGroup method.
The issue is that we have two types of objects (BeanPathMetaConstraintProcessedUnit and BeanGroupProcessedUnit) in the processedUnits Set. Sometimes two instances of theses classes have the same hashcode value. When applying the equals method, I encounter a ClassCastException.
This part of the equals method is the problem :
I think, the comparison should be o.getClass != BeanGroupProcessedUnit.class. There is the same problem in the BeanGroupProcessedUnit equals method.
Here is the stack trace:
6.0.4.Final, Java 8, BeanValidation 2.0