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

405 when method implemented generically in ancestor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 2.3.2.Final
    • jaxrs
    • None

    Description

      This bug is a bit complicated, best explained by example:

      1)
      class Disk extends Device {}

      2)
      class DeviceResource<D extends Device> { //notice: implementation of get() is with generic return type
      public D get(String id)

      { //... implementation, get the device }

      }

      3)
      class DiskResource extends DeviceResource<Disk> implements DiskResourceIfc{}

      4)
      interface DiskResourceIfc

      { @GET @Formatted public Disk get(); }

      When I try to GET a Disk I get 405 - method not allowed. I believe the reason for this is that rest-easy, using reflection, looks for implementation of: "public Disk get()" and doesn't find it, because the implementation is in the generic: "public D get()". The work-around that I found for the problem is overriding the generic method and calling super():

      class DiskResource extends DeviceResource<Disk> implements DiskResourceIfc{
      @Override
      public Disk get()

      { super.get(); }

      }

      Then it works.

      I believe that the behavior should be: if rest-easy doesn't find the exact method (i.e: "public Disk get()", it should search for possible generic signatures (i.e: "public D get()" ,D extends Device)

      Attachments

        Activity

          People

            rsigal@redhat.com Ronald Sigal
            oliel@redhat.com Ori Liel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: