users@jaxb.java.net

Re: Generated code uses unchecked conversion

From: Brian Pontarelli <brian_at_pontarelli.com>
Date: Fri, 15 Apr 2005 19:12:19 -0500

I think the cast to (Class) is what is causing the problem. The
String.class Object is inherently Class<String> so casting it to Class
is causing the compiler error. The XJC, shouldn't be generating the cast
unless absolutely necessary. This would fix the problem.

- brian


Kohsuke Kawaguchi wrote:

> Uday Subbarayan wrote:
>
>> [first i am not sure whether i should post it here or in the issues
>> mailing list OR a file a bug]
>
>
> In general, I believe there are some generics-related warnings that
> you cannot remove. And I think this is one of those.
>
>>
>> I used the 2.0EA xjc to compile my very simple XSD and then did javac,
>> ------------------------------------------------------------------------------------------------------------------------------------------
>>
>> C:\projects\Sonoa-Systems\Product\Sun\JAXB\Test\greeting\generated>javac
>> ObjectFactory.java -Xlint:unchecked
>> ObjectFactory.java:49: warning: [unchecked] unchecked conversion
>> found : java.lang.Class
>> required: java.lang.Class<java.lang.String>
>> return new JAXBElement<String>(_GREETING_QNAME, ((Class)
>> String.class), null, value);
>>
>> ^
>> 1 warning
>> ---------------------------------------------------------------------------------------------------------------------------------------------
>>
>> This needs to be fixed in the code generator class.
>>
>> Uday.
>>
>
>