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

Resource methods inherited from package-private class not registered

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 6.2.12.Final, 7.0.0.Final
    • jaxrs
    • None
      • Add resource class and parent class as described to an application
      • build, deploy and try to GET-request /root within the context of the application: The response is 404

      Consider a resource method inherited from a package-private superclass:

      abstract class PrivateAbstractResourceClass {
          @GET
          public String get() {
              return "test";
                }

      }

      @Path("root")
      public class TestInheritResourceMethodFromPrivateClass extends PrivateAbstractResourceClass { }

      The resource method declared in the superclass will be hidden by a bridge method in the resource class (https://bugs.openjdk.org/browse/JDK-6342411). Thus, as any other synthetic method, it won't be considered for registration as resource method by RESTEasy (https://github.com/resteasy/resteasy/blob/81ea5563a4d6e544f666c86cadab3c73a65e30ae/resteasy-core-spi/src/main/java/org/jboss/resteasy/spi/metadata/ResourceBuilder.java#L758)

      Expectation: The resource method is registered and works as expected, i.e. the respective requests are handled by the application containing the resource class.

      Of course, making the superclass public is a viable work-around. It is, however, not obvious and stronger encapsulation might be desirable.

              Unassigned Unassigned
              tom-g Tom Gottfried
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: