How to get rid of generics warnings in code generated from xmlbeans-maven-plugin?

六眼飞鱼酱① 提交于 2019-12-11 03:39:28

问题


I have some code generated from xsd files by xmlbeans-maven-plugin. Unfortunately generated code uses raw collection types, like:

java.util.List targetList = new java.util.ArrayList();
get_store().find_all_element_users(CURRENCY$0, targetList);
Currency[] result = new Currency[targetList.size()];
targetList.toArray(result);

which causes lots of warnings.
Is there a way to force the plugin to generate generic types or generate @SupressWarnings annotations? I use maven v 2.0.9, xmlbeans-maven-plugin v 2.3.3


回答1:


You can probably just generate generified code using a javaSource parameter of 1.5.




回答2:


You should try setting the source and target jdk versions to pre-1.5 to get rid of those warnings. Setting source version

e.g.

          <configuration>
               <source>1.4</source>
               <target>1.4</target>
           </configuration>


来源:https://stackoverflow.com/questions/3803346/how-to-get-rid-of-generics-warnings-in-code-generated-from-xmlbeans-maven-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!