GUACAMOLE-635: Heap pollution is not possible within SimpleDirectory(ObjectType... objects).

From https://docs.oracle.com/javase/tutorial/java/generics/nonReifiableVarargsType.html#vulnerabilities:

"Heap pollution occurs when a variable of a parameterized type refers
to an object that is not of that parameterized type."

In this case, the parameterized type (ObjectType) and the array of that
type within this constructor are always used as their formal types.
This commit is contained in:
Michael Jumper
2018-09-29 13:19:21 -07:00
parent 1fef6a05e1
commit 182f204c95

View File

@@ -85,6 +85,7 @@ public class SimpleDirectory<ObjectType extends Identifiable>
* @param objects
* The objects that should be present in this directory.
*/
@SafeVarargs
public SimpleDirectory(ObjectType... objects) {
this(Arrays.asList(objects));
}