Skip to content

Missing parameter metadata for several classes #2559

Closed

Description

@robp94

Describe the bug
Using quarkus with graphql and hibernate validator, I get the following warnings.

2021-09-22 10:09:38,512 WARN  [org.hib.val.int.pro.jav.JavaBeanExecutable] (Quarkus Main Thread) HV000254: Missing parameter metadata for RandomAccessWrappedList(AbstractMapBasedMultimap, Object, List, WrappedCollection), which declares implicit or synthetic parameters. Automatic resolution of generic type information for method parameters may yield incorrect results if multiple parameters have the same erasure. To solve this, compile your code with the '-parameters' flag.
2021-09-22 10:09:38,518 WARN  [org.hib.val.int.pro.jav.JavaBeanExecutable] (Quarkus Main Thread) HV000254: Missing parameter metadata for WrappedList(AbstractMapBasedMultimap, Object, List, WrappedCollection), which declares implicit or synthetic parameters. Automatic resolution of generic type information for method parameters may yield incorrect results if multiple parameters have the same erasure. To solve this, compile your code with the '-parameters' flag.
2021-09-22 10:09:38,528 WARN  [org.hib.val.int.pro.jav.JavaBeanExecutable] (Quarkus Main Thread) HV000254: Missing parameter metadata for WrappedCollection(AbstractMapBasedMultimap, Object, Collection, WrappedCollection), which declares implicit or synthetic parameters. Automatic resolution of generic type information for method parameters may yield incorrect results if multiple parameters have the same erasure. To solve this, compile your code with the '-parameters' flag.
2021-09-22 10:09:38,535 WARN  [org.hib.val.int.pro.jav.JavaBeanExecutable] (Quarkus Main Thread) HV000254: Missing parameter metadata for WrappedList(AbstractMapBasedMultimap, Object, List, WrappedCollection), which declares implicit or synthetic parameters. Automatic resolution of generic type information for method parameters may yield incorrect results if multiple parameters have the same erasure. To solve this, compile your code with the '-parameters' flag.
2021-09-22 10:09:38,545 WARN  [org.hib.val.int.pro.jav.JavaBeanExecutable] (Quarkus Main Thread) HV000254: Missing parameter metadata for WrappedCollection(AbstractMapBasedMultimap, Object, Collection, WrappedCollection), which declares implicit or synthetic parameters. Automatic resolution of generic type information for method parameters may yield incorrect results if multiple parameters have the same erasure. To solve this, compile your code with the '-parameters' flag.
2021-09-22 10:09:38,555 WARN  [org.hib.val.int.pro.jav.JavaBeanExecutable] (Quarkus Main Thread) HV000254: Missing parameter metadata for WrappedCollection(AbstractMapBasedMultimap, Object, Collection, WrappedCollection), which declares implicit or synthetic parameters. Automatic resolution of generic type information for method parameters may yield incorrect results if multiple parameters have the same erasure. To solve this, compile your code with the '-parameters' flag.

Which comes from classes from graphql-java like graphql.com.google.common.collect.AbstractMapBasedMultimap$RandomAccessWrappedList
For debugging, put a break point at org.hibernate.validator.internal.util.logging.Log_$logger#missingParameterMetadataWithSyntheticOrImplicitParameters

Could you add '-parameters' flag to compilation?

To Reproduce
code-with-quarkus-graphql-validator.zip

Activity

  1. andimarek commented on Sep 22, 2021

    @andimarek
    Member

    I don't really understand: these are private classes which are no exposed, why does it affect you?

  2. gsmet commented on Jan 6, 2022

    @gsmet

    Sorry for the delay in answering, Hibernate Validator lead here. The issue is that in the reproducer, there is an @Valid on a java.util.List which at runtime ends up being one of your private implementations. Thus Hibernate Validator creates metadata for these classes.
    When you have synthetic parameters, we need the classes to be compiled with -parameters to be able to make a proper link between the parameters and the generic parameters (which are separate arrays with very weird rules in Java).

    Anyway, I think it's now considered good practice to compile things with -parameters. I will provide a workaround for the OP but I think it would be nice to compile your library with this option.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions