浏览代码

Annotate Sets#of with @SafeVarArgs to prevent heap pollution warning

This prevents the warning:

  Potential heap pollution via varargs parameter

The method doesn't do any casting of types that would cause the heap
pollution, so it should be safe to add @SafeVarArgs.

See [1] for information about this warning.

[1] http://stackoverflow.com/a/12462259/381622

Change-Id: Ic6d252915ea44b4f1c385afecb98906cd2c54382
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
tags/v4.5.0.201609210915-r
David Pursehouse 7 年前
父节点
当前提交
0d872a0837
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1
    0
      org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java

+ 1
- 0
org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java 查看文件

@@ -47,6 +47,7 @@ import java.util.HashSet;
import java.util.Set;

public class Sets {
@SafeVarargs
public static <T> Set<T> of(T... elements) {
Set<T> ret = new HashSet<T>();
for (T element : elements)

正在加载...
取消
保存