swagger-api / swagger-api/swagger-core
Invalid detection of overridden methods (reopened #3426)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
Sorry for the long delay.
Unfortunately, swagger-core 2.2.16 does not yet solve the problem of #3426 . I missed some important stuff in the example parent class: The overridden method is protected which does not find the method when iterating via Class.getMethods(). Also the type variable is bounded, but this should not be a problem.
So this adapted example does not detect overriding properly:
public class Parent<T extends CharSequence> {
protected T get(String input) {
return null;
}
}
@Path("/inheritExample")
public class Resource extends Parent<String> {
@Override
@GET
@Path("/{input}")
public String get(@PathParam("input") String input) {
return super.get(input);
}
}
Again, this only applies to specific Java compilers that produce two methods of similar signature in the same class. I found JDK 11 from Oracle to behave accordingly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Parent and Resource example on Oracle JDK 11, then trace the method-discovery path that handles overridden methods. Done means the protected generic parent method is detected correctly for the annotated public override without breaking other compiler outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100