Hi,
What version of IKVM are you using? Do you have a repro?
Regards,
Jeroen
> -----Original Message-----
> From: Yevgen Kogan [mailto:eug...@we...]
> Sent: Tuesday, November 30, 2010 1:05 PM
> To: ikv...@li...
> Subject: [Ikvm-developers] Return type of
> java.lang.Class.getGenericSuperclass()
>
> Hi all,
>
> after 4 month of successfully using IKVM under .NET i got the first
> problem (generics):
> First i define in java a generic class
>
> class BaseClass<T extends MyType> {...}
>
> and then the class
>
> class ChildClass extends Baseclass<MyType1> {..}, where MyType1
> extends MyType.
>
> The compiled classes are loaded using the URLClassLoader and then i try
> to get some information about the class type (actually i need the name
> of the type parameter (MyType1) used in the declaration of ChildClass):
>
> java.lang.reflect.Type t = clazz.getGenericSuperclass(); //clazz is
> the loaded ChildClass
> ParameterizedType pt=(ParameterizedType)t; //after this cast the
> value of pt is null
>
> The last line is working fine with the sun JDK but with IKVM the value
> of pt is null.
>
> I far as i can see, the difference is, that the sun-Implementation of
> getGenericSuperclass() returns a ParameterizedTypeImpl (which has a
> Field "rawType" containing the raw type "BaseClass") and usng IKVM the
> same method returns the raw type (BaseClass) instead of
> ParameterizedTypeImpl, which is the reason for pt to be null after the
> casting.
>
> Do you have any idea of what is happening / what should i do to get the
> information about the type parameter?
>
> Thanks in advance,
> Yevgen
|