Annotations not found for Default Group on Interfaces


I'm writing some Proxy based framework which allows Bean validation. The user only declares interfaces and can annotate methods with Validation annotations. Unfortunately the way the validator discovers annotations for Default group seem to be not working for interfaces.
I think this is due to ValidatorImpl.validatePropertyForDefaultGroup, which is looping through the beanMetaData.getClassHierarchy(), which is empty for Interfaces.

If you do validation for non Default groups it's working, because ValidatorImpl.validatePropertyForNonDefaultGroup does not try to visit the classhierarchy.

Please see the attached file for an example of the situation I'm facing, you can easily modify the Test by activating Special group or not




Eric T
July 19, 2019, 2:57 PM

I noticed the ‘Fix Version’ label was removed from this issue and not updated. Is this an acknowledment that the issue was too difficult to fix, or just a signal that you plan on ignoring the issue indefinitely?

Eric T
February 11, 2019, 9:47 PM

Was this ever addressed elsewhere or is this still a known bug since 2013? This still appears to be an issue with 6.0.14.Final. I can provide a reproduction if necessary but it appears that enough information was provided in the original report. Just to confirm, according to the spec, should it be possible to have both class level constraints and property level constraints on an interface and to validate the property level constraints before the class level constraints utilizing @GroupSequence ? This works as expected when a class is used instead of an interface.

Hardy Ferentschik
November 14, 2013, 12:20 PM

Did something change for the validation between 4.3 and 5?

The obvious change is the switch from implementing Bean Validation 1.0 to Bean Validation 1.1. This also introduced as major new feature method/constructor validation. Conceptually, nothing has changed though, but of course we had to refactor and extend the code base to meet the new requirements.

Redefined default group sequences where already part of Bean Validation 1.0 and I am pretty sure that we also traversed the hierarchy in HV 4.3.

I also need to look at the code first to see whether we can do something about this problem.

Philipp Knobel
November 13, 2013, 9:10 PM

No, there will be no implementation of this Interface within my framework use (can't tell for anything beside it obviously). I didn't plan to use Javassist just to get the validation working, I would then rather go with a different approach for now.

I think in an earlier implementation of my code it worked, although I believe that I didn't do something basically different then. I used 4.3 validation, though and can remember that I never got it running with 5.x. Did something change for the validation between 4.3 and 5?

Gunnar Morling
November 13, 2013, 8:17 PM

That's an interesting case for sure.

By iterating through the hierarchy via getClassHierarchy() we actually also see constraints declared on implemented interfaces, but in your case there is nothing to iterate through as no actual classes are involved at all. Not sure out of my head how we should handle re-defined default group sequences in this case (which are the reason for doing the hierarchy traversal).

You will never have an implementation of these interfaces? As a workaround, you might try using class based proxies with e.g. Javassist; that way the hierarchy traversal should kick in, but I agree that it also should work in the case you describe.




Philipp Knobel



Feedback Requested


Feedback Requested By




Suitable for new contributors


Pull Request







Affects versions