【发布时间】:2011-01-26 00:40:09
【问题描述】:
我有以下代码:
private static final Set<String> allowedParameters;
static {
Set<String> tmpSet = new HashSet();
tmpSet.add("aaa");
allowedParameters = Collections.unmodifiableSet(tmpSet);
}
它导致:
Note: mygame/Game.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
当我使用建议的选项重新编译时,我看到一个指针 (^) 指向 HashSet(); 前面的“new”。
有人知道这里发生了什么吗?
【问题讨论】:
标签: java generics collections hashset