Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jerseyrobot opened this issue Feb 23, 2018 · 1 comment

Comments

@jerseyrobot
Copy link
Contributor

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.
@jerseyrobot
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant