Skip to content
This repository has been 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

Open
sergeijakovlev opened this issue Feb 23, 2018 · 0 comments

Comments

@sergeijakovlev
Copy link

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant