I am puzzled by the javax.validation API. I am writing a simple test to understand it :
Sample sample = new Sample();
Set<ConstraintViolation<Sample>> violations = validator.validate(sample);
if (!violations.isEmpty()) {
// Eclipse refuses to let me use my violations variable
throw new ConstraintViolationException(violations);
}
How should I declare the set of violations so I can use it in my exception constructor?