我有两个警告:
– 第一是:
– 第一是:
HELPDESKGESTION2\src\java\glpi\filter\LoginFilter.java:289: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable localParams.put(key,value); ^
– 二是:
HELPDESKGESTION2\src\java\glpi\filter\LoginFilter.java:292: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable localParams.put(name,values); ^
public void setParameter(String name,String []values) { if (debug) System.out.println("LoginFilter::setParameter(" + name + "=" + values + ")" + " localParams = "+ localParams); if (localParams == null) { localParams = new Hashtable(); // Copy the parameters from the underlying request. Map wrappedParams = getRequest().getParameterMap(); Set keySet = wrappedParams.keySet(); for (Iterator it = keySet.iterator(); it.hasNext(); ) { Object key = it.next(); Object value = wrappedParams.get(key); localParams.put(key,value); } } localParams.put(name,values); }
解决方法
更换:
localParams = new Hashtable();
附:
localParams = new Hashtable<String,String>();
我假设你有一个全局变量,如下所示:
private Hashtable localParams;
替换为:
private Hashtable<String,String> localParams;
如果您进行更改,我建议警告将消失,但您也必须用String替换所有的Object;