eclipse-equinox / p2

Eclipse Public License 2.0
14 stars 40 forks source link

Unlikely argument type #440

Open laeubi opened 7 months ago

laeubi commented 7 months ago

From the compiler logs

Unlikely argument type for equals(): TB seems to be unrelated to TA
4. INFO in bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CoercingComparator.java (at line 327)
    return o2.equals(o1);
                     ^^
Unlikely argument type for equals(): TA seems to be unrelated to TB
5. INFO in bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CoercingComparator.java (at line 336)
    return o1.equals(o2);
                     ^^
Unlikely argument type for equals(): TB seems to be unrelated to TA
merks commented 7 months ago

@laeubi

Should we just add this?

image

laeubi commented 7 months ago

Good question, the class is maybe doing some strange things the compiler does not understand or there is a real error...

I just noticed in the past that "Unlikely argument type" was often a sign that I did something by accident than by intend.

In this case I think the compiler is concerned because of <TA extends Object, TB extends Object> it assumes different types but using equals method of object that never returns true if not o1 == o2 ...