Java 7
I wrote this:
public static <E extends Enum<E>> List<SelectItem> getSelectItemList(Enum<E>... es){
List<SelectItem> items = new ArrayList<SelectItem>();
for(Enum<E> e : es){
items.add(new SelectItem(e, e.toString()));
}
return items;
}
and this method compiled with no warning. Why? I expected that such using of varargs of a generic type (which is actually an array) produces
Potential heap pollution via varargs parameter es
Couldn't you explain it?