@SuppressWarningsJava 中有效警告名称的列表是什么?
进来之间的("")位@SuppressWarnings("").
我创建了一个简单的Counter类:
public class Counter<T> extends HashMap<T, Long> {
public Counter() {
}
public void increase(T key) {
put(key, getOrDefault(key, 0l) + 1);
}
}
Run Code Online (Sandbox Code Playgroud)
在我的代码中,我调用increase()方法,然后使用Map方法访问数据,例如
Counter<Integer> counter = new Counter<>();
for (Integer i: ... some collection ...)
counter.increase(i);
Run Code Online (Sandbox Code Playgroud)
Intellij counter用警告颜色突出显示(最后一行代码片段)的声明,工具提示消息说明
查询集合的内容,但从未更新.
显然我可以忽略这个警告,但有没有办法说服Intellij我的代码没有任何问题?
我正在使用14.0.2社区版.