Questions tagged «unchecked»

在我的spring应用程序上下文文件中,我有类似以下内容: <util:map id="someMap" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String"> <entry key="some_key" value="some value" /> <entry key="some_key_2" value="some value" /> </util:map> 在java类中,实现如下所示: private Map<String, String> someMap = new HashMap<String, String>(); someMap = (HashMap<String, String>)getApplicationContext().getBean("someMap"); 在Eclipse中,我看到一条警告: 类型安全性:未经检查的从Object到HashMap的强制转换 我做错什么了?我该如何解决该问题?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.