-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
We want to annotate a getter on one of our classes with the @Valid annotation to allow cascading validation. AutoValue copies this annotation to the AutoValue class. This results in the following error message:
HV000131: A method return value must not be marked for cascaded validation more than once in a class hierarchy, but the following two methods are marked as such: public my.name.space.Parameters my.name.space.AutoValue_Class.getParameters(), public abstract my.name.space.Parameters my.name.space.Class.getParameters().
We are working around this by applying the annotation to the parameter in the factory method.
e.g.
@JsonCreator
public static Class create(@Valid Parameters parameters){ /* code */ }
It would be nicer if the @Valid were not copied to the autovalue class so we could annotate the getting directly.