开发者

Get rid of redundant cast to javax.xml.bind.JAXBElement<java.lang.Boolean> warning from CXF-generated code

I generate some code using CXF from a WSDL-file. When compiling the code with version "1.6.0_16" with the flag -Xlint I get the following warning:

warning: [cast] redundant cast to javax.xml.bind.JAXBElement<java.lang.Boolean>
   [javac]         this.r = ((JAXBElement<Boolean> ) value);

What does the warning mean, should I be worried? As I have generated and not written the code, what can I do to get rid开发者_如何学JAVA of this specific warning?


No, you should not be worried, redundant casts are harmless.

It's common for generated code to compile with warnings, you generally just ignore them. Better yet, compile the generated code into a separate JAR, and reference that from your main code. That way, you don't need to recompile the generated code, and you won't see the warnings every time.


I had a similar problem while CXF was generating code redundant cast to byte[] while -Werror and -Xlint:all was set in maven to compile the code

A possible workaround for me/us was to add:

-Xlint:-cast to suppress the warning and keep the -Werror flag

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜