Summary: | [dom] API to get generic type from parametrized type binding | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Martin Aeschlimann <martinae> |
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | dirk_baeumer, markus.kell.r, Olivier_Thomann, tobias_widmer |
Version: | 3.0 | ||
Target Milestone: | 3.1 M4 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 78183 |
Description
Martin Aeschlimann
2004-11-01 07:02:15 EST
> What does exist are methods 'getErasure()' to get c. from a. and b. and
> isRawType() to test for c.
That's not exactly true in 200411022000. [Note: I use List<E> where Martin wrote
List<T>, since List<E> is used in jdk1.5 source.]
Calling getErasure() on source reference binding for 'List' (raw, c.) or
'List<String>' (parameterized, b.) yields List<E> (declaration, a.), whose
getTypeParameters() is {E} and whose isParameterizedType() and isRawType() both
return false.
getErasure() is a link a./b./c. ==> a.
Test for a.: isRawType() == false && isParameterizedType() == false
[Test whether type is generic: getTypeParameters().length != 0]
Test for b.: isParameterizedType() == true
Test for c.: isRawType() == true
Missing links are
AB.) a. ==> b.: List<E>, type argument 'String' ==> List<String>
AC.) a. ==> c.: List<E> ==> List
Conversions b. ==> c. and c. ==> b. can be composed from getErasure() and AC.
and AB.
Along the lines of making DOM AST more usable. I think this bug is mostly solved with the latest API additions - isGenericType() marks a.) - isParameterizedType() marks b.) - isRawType() marks c.) getErasure() gives a.) from b. and c. Missing are methods for get b. or c. from a.) but that was an 'nice to have' request and along the lines of bug 40096 (please reopen that one... :-)) Martin, since this bug was entered, only isGenericType() was added. So I guess this bug should have been a request for isGenericType(), right ? yes, isGenericType() was in fact the main request. The rest is covered by bug 40096 |