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 without warning. What for? I expected that using varargs of a typical type (which is actually an array) creates
Potential heap pollution via varargs parameter es
Could you explain this?
source share