eclipse-ee4j / eclipse-ee4j/jersey

WorkerComparator not following spec when multiple interface inheritance

Open
#3,477 4 comments 0 reactions 0 assignees View on GitHub
Priority: Critical Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

org.glassfish.jersey.message.internal.MessageBodyFactory.WorkerComparator#getTypeDistance has a bug when the wanted type is two or more deep interface inheritance.

Exemple:

I have 2 interfaces, D and C. C extends D and a class A implementing C. If we model horizontally interface inheritance and vertically class inheritance we would get something like this.

A - C - D

Object

If I have two MessageBodyWriter one for Object and one for D, when selecting which is closest, getTypeDistance will return 2 for Object and 3 for D which is not valid. It makes no sense to have an interface or class be further from another than Object. Object should always be the furthest class from any given class.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.