eclipse-ee4j / eclipse-ee4j/jersey
Bridge methods generated for public methods of non-public superclasses are ignored
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.