ClassCastException due to unchecked cast in ValidatorImpl

Description

There is an unsafe cast in method collectMetaConstraintsForPath in class ValidatorImpl which might result in ClassCastException under some circumstances. The problem is in the following line:

When newValue is null, the variable type is casted to Class, but it might be of type (for example) ParameterizedTypeImpl since it is initialized like this:

I'm not completely sure about conditions, but we are experiencing it from time to time.

Environment

None

Status

Assignee

Unassigned

Reporter

František Řezáč

Labels

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

Yes, likely

Pull Request

None

backportDecision

None

backportReEvaluate

None

Time tracking

8h

Components

Affects versions

Priority

Major
Configure