Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-923

Only the root method of an overridden method in an inheritance hierarchy may be annotated with parameter constraints

    Details

      Description

      If my resource is EJB with JAX-RS annotations on it's interface then I get ConstraintDeclarationException.

      If I specify @ValidateRequest on Impl then there is no validation at all.

      This might be related to https://hibernate.atlassian.net/browse/HV-448

      @Stateless
      public class UserResourceImpl implements UserResource {
      @Override
      public User register(@Nonnull String email, @Nonnull String password) throws EmailAleadyRegisteredException
      {}
      }

      @RolesAllowed(Roles.USER)
      @Path("/user")
      public interface UserResource {
      @ValidateRequest
      @Consumes(

      {MediaType.TEXT_PLAIN}

      )
      @PermitAll
      @POST
      @Path("/")
      User register(@NotNull @FormParam("email") String email, @NotNull @FormParam("password") String password) throws EmailAleadyRegisteredException;
      }

      Call to such method results in:

      javax.validation.ConstraintDeclarationException: Only the root method of an overridden method in an inheritance hierarchy may be annotated with parameter constraints, but there are parameter constraints defined at all of the following overridden methods: [MethodMetaData [method=public abstract example.server.rest.domain.User example.server.rest.UserResource.register(java.lang.String,java.lang.String) throws example.server.business.EmailAleadyRegisteredException, parameterMetaData=[ParameterMetaData [type=class java.lang.String], [index=0], name=arg0], constraints=[NotNull], isCascading=false], ParameterMetaData [type=class java.lang.String], [index=1], name=arg1], constraints=[NotNull], isCascading=false]], constraints=[], isCascading=false, hasParameterConstraints=true], MethodMetaData [method=public example.server.rest.domain.User example.server.rest.UserResource$$$view306.register(java.lang.String,java.lang.String) throws example.server.business.EmailAleadyRegisteredException, parameterMetaData=[ParameterMetaData [type=class java.lang.String], [index=0], name=arg0], constraints=[NotNull], isCascading=false], ParameterMetaData [type=class java.lang.String], [index=1], name=arg1], constraints=[NotNull], isCascading=false]], constraints=[], isCascading=false, hasParameterConstraints=true]]

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ron_sigal Ron Sigal
                  Reporter:
                  blabno Bernard Labno
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: