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

@Produces not picked up well


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 4.3.0.Final, 3.9.0.Final
    • 4.1.1.Final, 3.8.1.Final
    • jaxrs
    • None

      Dear RESTEasy team,

      When working on a project using RESTEasy (using Jackson and JAX-RS) I noticed that when a class is annotated with @Produces isn't recognized (and thus it uses a default, in my case application/octet-stream). In the end this was because of a cached .class file somewhere, but in my debugging I found something that could be a bug (if it would be different it would have worked no matter of this cached file).

      After some research I found that this was because the ServerResponseWriter class (link) has the following code:

      hasProduces |= method != null && method.getMethod().getClass().getAnnotation(Produces.class) != null;

      What happens here though, is that the Method class is returned instead of the class that actually defines the method (the class that contains the annotation). I'd expect the method.getMethod().getDeclaringClass() here, which would return the class where it's defined (and which contains the @Produces annotation.

      I assume this is unintended behavior, therefore I'm submitting a bug report here. If this is expected behavior, I apologize.

            spyrkob Bartosz Spyrko-Smietanko
            robbinbaauw Robbin Baauw (Inactive)
            0 Vote for this issue
            4 Start watching this issue