'hibernate executableValidator does not work inside the method

I'm trying to implement addNew method parameters validation with this code

public void addNew(@NotNull(message = "FieldManager is Null")
                               FieldManager fieldManager
            , @NotNull(message = "ProjectManager is Null")
                               ProjectManager projectManager
            , @NotNull(message = "FieldConfigSchemeManager is Null")
                               FieldConfigSchemeManager fieldConfigSchemeManager
            , @NotNull(message = "OptionsManager is Null")
                               OptionsManager optionsManager) {
        
        ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
        ExecutableValidator executableValidator = factory.getValidator().forExecutables();
        Set<ConstraintViolation<MutableOptionsList.addNew>> violations =
                executableValidator.validateParameters(fieldManager, projectManager, fieldConfigSchemeManager, optionsManager);
    

but compiler does not recognise parameters of validateParameters method. I can not find the full example of implementation of validation inside the method in doc. What am I doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source