Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 109487

Summary: [dom] Bindings for unbound wildcard type should be unique
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: dirk_baeumer, martinae
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2005-09-14 06:09:50 EDT
I20050906-1200

public class Try {
    Class<?> c;
    java.util.List<?> l;
}

The bindings for the ? in Class<?> and List<?> are not identical and have
different keys, but isEqualTo(..) returns true. The resolved bindings should be
identical.

The key should match the one from BindingKey#createWilcardTypeBindingKey(..) and
BindingKey#internalToSignature() should convert it to a valid signature.
Comment 1 Philipe Mulet CLA 2005-09-22 10:51:58 EDT
Wildcard bindings retain information from their associated type parameter, for
enabling capturing; and thus are not identical.

It is questionable they should compare equal.
Comment 2 Markus Keller CLA 2005-09-28 12:35:49 EDT
Hmm, our TTypes (and probably other clients) currently assume wildcard types are
unique if their bounds are the same. If that's not true any more with captures,
then we should probably add a query to differentiate the two.

OTOH, are you sure the additional information is really about the associated
type parameter? When I inspect the program below, I see that the type bindings
for the two '?' have the same key 'Lxy/Try~Two;*'. If the bindings should really
be different, then their keys should be changed to include more information than
they currently do (looks like the declaring type only).

class Try {
    void m() {
        Two<?, ?> two= new Two<String, Integer>();
    }
}
class Two<A, B extends Number> { }
Comment 3 Philipe Mulet CLA 2007-04-27 03:42:08 EDT
Jerome - the point on binding keys is valid. Different bindings shouldn't have the same key.
Comment 4 Jerome Lanneluc CLA 2007-06-20 11:42:34 EDT
BindingComparator#isEqual(TypeBinding, TypeBinding, HashSet) should take into account WildCardBinding#typeVariable.
The binding key should also include the type variable.
Comment 5 Jerome Lanneluc CLA 2008-05-07 07:55:30 EDT
Deferring post 3.4
Comment 6 Eclipse Genie CLA 2019-03-30 15:19:07 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.