Lucas wrote:
> Anybody knows how to get a IType from a field's type.
> ex. i have a IField correspondent to
> private Address ad;
>
> Now i need a IType of Address, but i don't known how to get it from IField.
I think getDeclaringType() should match your need. It's implemented on
IMember (IField super-interface).
Frederic Fusier wrote:
> Lucas wrote:
>> Anybody knows how to get a IType from a field's type.
>> ex. i have a IField correspondent to
>> private Address ad;
>>
>> Now i need a IType of Address, but i don't known how to get it from
>> IField.
>
> I think getDeclaringType() should match your need. It's implemented on
> IMember (IField super-interface).
>
> Note that documentation of this method sounds really wrong and I've
> opened a bug for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=169114
Ooops, forget my previous answer, I misunderstood getDeclaringType()
behavior. I've also invalidated the bug...
My mind seems not to work very well between Christmas and New year feast.
Frederic Fusier wrote:
> Frederic Fusier wrote:
>> Lucas wrote:
>>> Anybody knows how to get a IType from a field's type.
>>> ex. i have a IField correspondent to
>>> private Address ad;
>>>
>>> Now i need a IType of Address, but i don't known how to get it from
>>> IField.
>>
>> I think getDeclaringType() should match your need. It's implemented on
>> IMember (IField super-interface).
>>
>> Note that documentation of this method sounds really wrong and I've
>> opened a bug for this:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=169114
>
> Ooops, forget my previous answer, I misunderstood getDeclaringType()
> behavior. I've also invalidated the bug...
> My mind seems not to work very well between Christmas and New year feast.
In fact, it seems you cannot directly get the IType for the field's
type, but only its signature using field.getTypeSignature().
Then for BinaryField, it's easy to get corresponding IType using
following code:
String typeSignature = field.getTypeSignature();
field.getJavaProject().findType(Signature.toString(typeSigna ture))
For SourceField, it's a little bit more tricky as the type signature is
not resolved...
ILucas wrote:
> Anybody knows how to get a IType from a field's type.
> ex. i have a IField correspondent to
> private Address ad;
>
> Now i need a IType of Address, but i don't known how to get it from IField.