eclipse-ee4j / eclipse-ee4j/jersey
Filter out synthetic methods from processing in MethodList
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
Kotlin compiler since version 1.3.0 starts to generates synthetics methods for method with default arguments with ACC_SYNTHETIC flag only (before 1.3.0 it's generate them also with ACC_BRIDGE flag).
So it's breaks Jersey on next Kotlin code cause Jersey tries to process synthetic method:
```
@Path("/")
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
@PermitAll
class MyResource {
....
@GET
fun get(@Context uriInfo: UriInfo,
@Context requestContext: ContainerRequestContext,
@QueryParam("externalId") externalId: String?,
@QueryParam("name") name: String? ,
@QueryParam("description") description: String?,
@QueryParam("source") source: String? ,
@QueryParam("status") status: String? ,
@QueryParam("skip") skip: Int? ,
@QueryParam("limit") limit: Int? ,
@HeaderParam("X-FOO-CLIENT-KEY") clientKey: String? = null): Response {
return Response.ok(listOf(Info("foo"))).build()
}
}
```
Jersey filtering:
```
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection methods) {
List l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
```
Related Kotlin issue and sample project: https://youtrack.jetbrains.com/issue/KT-28684
Contributor guide
Assessment
This issue has not been assessed yet.