fix the type safety warning for the `EMPTY_LIST` usage
The following warning is issued for `Collections.EMPTY_LIST` usage:
Type safety: The expression of type List needs unchecked conversion
to conform to List<...>
Fix it by using `Collections.emptyList()` that performs the necessary
conversion.
Change-Id: Ic9e16feb4957d9e26b63929d1dbaeb9d4d282f92
diff --git a/owners-common/src/test/java/com/googlesource/gerrit/owners/common/PathOwnersTest.java b/owners-common/src/test/java/com/googlesource/gerrit/owners/common/PathOwnersTest.java
index ac865ed..6c949f5 100644
--- a/owners-common/src/test/java/com/googlesource/gerrit/owners/common/PathOwnersTest.java
+++ b/owners-common/src/test/java/com/googlesource/gerrit/owners/common/PathOwnersTest.java
@@ -15,7 +15,7 @@
package com.googlesource.gerrit.owners.common;
import static com.googlesource.gerrit.owners.common.MatcherConfig.suffixMatcher;
-import static java.util.Collections.EMPTY_LIST;
+import static java.util.Collections.emptyList;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
@@ -27,7 +27,6 @@
import com.google.gerrit.entities.RefNames;
import java.io.IOException;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -68,7 +67,7 @@
accounts,
repositoryManager,
repository,
- Collections.EMPTY_LIST,
+ emptyList(),
branch,
Set.of(CLASSIC_FILE_TXT),
EXPAND_GROUPS);
@@ -88,7 +87,7 @@
accounts,
repositoryManager,
repository,
- EMPTY_LIST,
+ emptyList(),
branch,
Set.of(CLASSIC_FILE_TXT),
DO_NOT_EXPAND_GROUPS);
@@ -108,7 +107,7 @@
accounts,
repositoryManager,
repository,
- EMPTY_LIST,
+ emptyList(),
Optional.empty(),
Set.of(CLASSIC_FILE_TXT),
EXPAND_GROUPS);
@@ -128,7 +127,7 @@
accounts,
repositoryManager,
repository,
- EMPTY_LIST,
+ emptyList(),
branch,
Set.of("classic/file.txt"),
EXPAND_GROUPS);
@@ -157,7 +156,7 @@
accounts,
repositoryManager,
repository,
- EMPTY_LIST,
+ emptyList(),
branch,
Set.of(fileName),
EXPAND_GROUPS);
@@ -269,7 +268,7 @@
accounts,
repositoryManager,
repository,
- EMPTY_LIST,
+ emptyList(),
branch,
Set.of("dir/subdir/file.txt"),
EXPAND_GROUPS);
diff --git a/owners-common/src/test/java/com/googlesource/gerrit/owners/common/RegexTest.java b/owners-common/src/test/java/com/googlesource/gerrit/owners/common/RegexTest.java
index 72a6d84..8ae411e 100644
--- a/owners-common/src/test/java/com/googlesource/gerrit/owners/common/RegexTest.java
+++ b/owners-common/src/test/java/com/googlesource/gerrit/owners/common/RegexTest.java
@@ -22,7 +22,7 @@
import static com.googlesource.gerrit.owners.common.MatcherConfig.regexMatcher;
import static com.googlesource.gerrit.owners.common.MatcherConfig.suffixMatcher;
import static com.googlesource.gerrit.owners.common.StreamUtils.iteratorStream;
-import static java.util.Collections.EMPTY_LIST;
+import static java.util.Collections.emptyList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.powermock.api.easymock.PowerMock.replayAll;
@@ -148,7 +148,7 @@
accounts,
repositoryManager,
repository,
- EMPTY_LIST,
+ emptyList(),
branch,
Set.of(
"project/file.txt", // matches exact in
@@ -263,7 +263,7 @@
accounts,
repositoryManager,
repository,
- EMPTY_LIST,
+ emptyList(),
branch,
Set.of("project/file.sql", "another.txt"),
EXPAND_GROUPS);