简体   繁体   中英

warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List

I am getting warning

warning: [unchecked] unchecked call to add(E) as a member of the 
raw type java.util.List
    [javac]      listbox.getChildren().add(listaMenu); 

where listaMenu is declared as

UISelectItems listaMenu = new UISelectItems();

and listbox is declared as

HtmlSelectOneListbox listbox = new HtmlSelectOneListbox();

How can I get rid of this warning message when I compile using ant build tasks?

Thanks

要么获得你正在使用的Faces API实现的新版本(支持泛型的实现),要么在函数开始之前放置@SuppressWarnings("unchecked") (就在publicprivate之前)。

Add an annotation to suppress the warning if the JSF API forces the use of unchecked casting:

@SuppressWarnings(value = "unchecked")

Similar to the answer(s) given here: Java [unchecked] unchecked case warning

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM