Skip to content

HV000151: A method overriding another method must not redefine the parameter constraint configuration #35144

Open

Description

I use

  • reactivity (quarkus-resteasy-reactive-jackson, quarkus-rest-client-reactive-jackson)
  • Java 11
  • Quarkus 3.2.2.Final

When I try to run the application, , I end up with following error:

Caused by: jakarta.validation.ConstraintDeclarationException: HV000151: A method overriding another method must not redefine the parameter constraint configuration, but method TestServiceInterface$$CDIWrapper#doSomething(String) redefines the configuration of TestServiceInterface#doSomething(String).
at org.hibernate.validator.internal.metadata.aggregated.rule.OverridingMethodMustNotAlterParameterConstraints.apply(OverridingMethodMustNotAlterParameterConstraints.java:24)
at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.assertCorrectnessOfConfiguration(ExecutableMetaData.java:462)
at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.build(ExecutableMetaData.java:380)
at org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataBuilder$BuilderDelegate.build(BeanMetaDataBuilder.java:260)
at org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataBuilder.build(BeanMetaDataBuilder.java:133)
at org.hibernate.validator.internal.metadata.PredefinedScopeBeanMetaDataManager.createBeanMetaData(PredefinedScopeBeanMetaDataManager.java:155)
at org.hibernate.validator.internal.metadata.PredefinedScopeBeanMetaDataManager.(PredefinedScopeBeanMetaDataManager.java:100)
at org.hibernate.validator.internal.engine.PredefinedScopeValidatorFactoryImpl.(PredefinedScopeValidatorFactoryImpl.java:206)
at org.hibernate.validator.PredefinedScopeHibernateValidator.buildValidatorFactory(PredefinedScopeHibernateValidator.java:42)
at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.buildValidatorFactory(AbstractConfigurationImpl.java:435)
at io.quarkus.hibernate.validator.runtime.HibernateValidatorRecorder$2.created(HibernateValidatorRecorder.java:178)
at io.quarkus.arc.runtime.ArcRecorder.initBeanContainer(ArcRecorder.java:79)
at io.quarkus.deployment.steps.ArcProcessor$generateResources844392269.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.ArcProcessor$generateResources844392269.deploy(Unknown Source)
... 15 more

I have an interface, with parameter annotated @ConvertGroup(to = Error.class) and I have an implementation of that interface:

image
image

I understand that there are $$CDIWrapper classes which are generated from the interface.
I have noticed, that when applying OverridingMethodMustNotAlterParameterConstraints, there is an issue that callable
TestServiceInterface$$CDIWrapper#doSomething(String) has empty groupConversions while TestServiceInterface#doSomething(String) have exactly one...

I think this is a bug.
What is interesting, I tried to dump all generated classes with (-Dquarkus.debug.generated-classes-dir=dump-classes) and I can see, that the ConvertGroup annotation is present on that $$CDIWrapper class:

image

Here is a project to reproduce the error https://github.com/dntichy/convert-group-minimal-example

Expected behavior

Exception should not be thrown and app should start properly

Actual behavior

Exception is thrown upon startup

How to Reproduce?

Here is a project to reproduce the error https://github.com/dntichy/convert-group-minimal-example

Output of java -version

openjdk version "11.0.19" 2023-04-18 LTS
OpenJDK Runtime Environment Corretto-11.0.19.7.1 (build 11.0.19+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.19.7.1 (build 11.0.19+7-LTS, mixed mode)

Quarkus version or git rev

3.2.2.Final

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions