The fix for
GROOVY-6804 only works for primitive arguments because the distance calc doesn't wrap and compare against reference param types. I believe it should wrap before doing the compare (which would fix GROOVY-8055) and believe the current test is only passing because of this anomaly with primitives.
The following test is the same from
GROOVY-6804 but instead uses the wrapper type and fails to compile:
In the case of a primitive both K-Serializable and V-Object (as seen by the getDistance()) method have the same distance so both are promoted as possible choices. The generic type information is not evaluated until later and when generics are applied the correct method is chosen. However, in the case of the reference type K-Serializable is the only method because it has the lowest distance calc and generics are not evaluated.
It seems that the fix would be to resolve the types prior to making the distance calculation.