Possible heap pollution via varargs parameter
问题 I understand this occurs with Java 7 when using varargs with a generic type; But my question is.. What exactly does Eclipse mean when it says \"its use could potentially pollute the heap?\" And How does the new @SafeVarargs annotation prevent this? 回答1: Heap pollution is a technical term. It refers to references which have a type that is not a supertype of the object they point to. List<A> listOfAs = new ArrayList<>(); List<B> listOfBs = (List<B>)(Object)listOfAs; // points to a list of As