HashMap<String,String> index = (HashMap<String,String>)session.getAttribute("index");
写这段代码是得到了Type safety: Unchecked cast from Object to HashMap<String,String>这样的警告
有兴趣的话可以参考下
http://stackoverflow.com/questions/509076/how-do-i-address-unchecked-cast-warnings/509230#509230
出现这个警告是因为进行强制转换的Object的类型没有经过确认,所以这个类型转换时不安全的。如果你确认Object的类型与HashMap的类型一致的话,可以加上在前面加上@SuppressWarnings("unchecked")来除掉这个警告
Example:
@SuppressWarnings("unchecked")
Map<String, String> myMap = (Map<String, String>) deserializeMap();