Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.
This repository was archived by the owner on May 28, 2018. It is now read-only.

Bridge methods generated for public methods of non-public superclasses are ignored #3775

@sergeijakovlev

Description

@sergeijakovlev

Current implementation of MethodList explicitly ignores bridge methods: https://github.com/jersey/jersey/blob/master/core-server/src/main/java/org/glassfish/jersey/server/model/MethodList.java#L123-L127

Unfortunately, since Java 6 bridge methods are generated for public methods inherited from non-public superclasses due to an issue with reflective invocation of such methods (https://bugs.java.com/view_bug.do?bug_id=6342411). This causes issues when a public resource class extends a non-public class that contains public methods. According to my understanding, such methods should be considered public methods of the subclass and, as such, are eligible for handling requests. Currently such methods are not scanned and requests that should be mapped to those methods return 404.

An example of failing tests for MethodList implementation can be found here: https://gist.github.com/sergeijakovlev/315c3a87788bfbd31a81cb4a91dd84ee

Currently possible workarounds are:

  1. Make the superclass public. This is what we have to do currently, but it exposes more than is necessary.
  2. Override all methods that need to be exposed in the subclass. This is quite bad.

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