Remove redundant type arguments
Change-Id: I0e32a0a82245fcae6e2cbd29beec7475a9a13cd2
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java
index f99b3fe..ef5379c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java
@@ -217,7 +217,7 @@
if (toBranch == null) {
throw new IllegalArgumentException("toBranch cannot be null");
}
- Set<String> upstreamBranches = new HashSet<String>();
+ Set<String> upstreamBranches = new HashSet<>();
// List all subsections of automerger, split by :
Set<String> subsections = getConfig().getSubsections(pluginName);
for (String subsection : subsections) {
@@ -250,7 +250,7 @@
*/
public Set<String> getDownstreamBranches(String fromBranch, String project)
throws RestApiException, IOException, ConfigInvalidException {
- Set<String> downstreamBranches = new HashSet<String>();
+ Set<String> downstreamBranches = new HashSet<>();
// List all subsections of automerger, split by :
Set<String> subsections = getConfig().getSubsections(pluginName);
for (String subsection : subsections) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java
index 1d49922..4bd1a6c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java
@@ -570,7 +570,7 @@
}
// Map whether or not we should merge it or skip it for each downstream
- Map<String, Boolean> dsBranchMap = new HashMap<String, Boolean>();
+ Map<String, Boolean> dsBranchMap = new HashMap<>();
for (String downstreamBranch : downstreamBranches) {
boolean isSkipMerge = config.isSkipMerge(change.branch, downstreamBranch, change.subject);
dsBranchMap.put(downstreamBranch, !isSkipMerge);
@@ -619,7 +619,7 @@
log.debug("Giving {} for label {} to {}", vote, label, change.id);
// Vote on all downstream branches unless merge conflict.
ReviewInput reviewInput = new ReviewInput();
- Map<String, Short> labels = new HashMap<String, Short>();
+ Map<String, Short> labels = new HashMap<>();
labels.put(label, vote);
reviewInput.labels = labels;
reviewInput.notify = NotifyHandling.NONE;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/FailedMergeException.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/FailedMergeException.java
index 2813c60..96c567c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/FailedMergeException.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/FailedMergeException.java
@@ -57,7 +57,7 @@
* @return A string representation of the conflicts.
*/
public String getDisplayString() {
- List<String> conflictMessages = new ArrayList<String>();
+ List<String> conflictMessages = new ArrayList<>();
for (Map.Entry<String, String> branchMapEntry : failedMergeBranchMap.entrySet()) {
String branch = branchMapEntry.getKey();
String mergeConflictMessage = branchMapEntry.getValue();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/ManifestReader.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/ManifestReader.java
index 80d26c0..a71e1c0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/ManifestReader.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/ManifestReader.java
@@ -48,7 +48,7 @@
* @return The set of projects in the manifest.
*/
public Set<String> getProjects() {
- Set<String> projectSet = new HashSet<String>();
+ Set<String> projectSet = new HashSet<>();
try {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/QueryBuilder.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/QueryBuilder.java
index 9defd08..ff5767c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/QueryBuilder.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/QueryBuilder.java
@@ -24,7 +24,7 @@
private Map<String, String> queryStringMap;
public QueryBuilder() {
- this.queryStringMap = new HashMap<String, String>();
+ this.queryStringMap = new HashMap<>();
}
public void addParameter(String key, String value) throws InvalidQueryParameterException {
@@ -48,7 +48,7 @@
}
public String get() {
- List<String> queryStringList = new ArrayList<String>();
+ List<String> queryStringList = new ArrayList<>();
for (Map.Entry<String, String> entry : queryStringMap.entrySet()) {
queryStringList.add(entry.getKey() + ":" + entry.getValue());
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java
index 3817c3e..d07fded 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java
@@ -57,7 +57,7 @@
@Test
public void getProjectsInScopeTest_addProjects() throws Exception {
defaultSetup("automerger.config");
- Set<String> expectedProjects = new HashSet<String>();
+ Set<String> expectedProjects = new HashSet<>();
expectedProjects.add("platform/whee");
expectedProjects.add("platform/added/project");
assertThat(configLoader.getProjectsInScope("master", "ds_one")).isEqualTo(expectedProjects);
@@ -66,7 +66,7 @@
@Test
public void getProjectsInScopeTest_setProjects() throws Exception {
defaultSetup("automerger.config");
- Set<String> otherExpectedProjects = new HashSet<String>();
+ Set<String> otherExpectedProjects = new HashSet<>();
otherExpectedProjects.add("platform/some/project");
otherExpectedProjects.add("platform/other/project");
otherExpectedProjects.add("platform/added/project");
@@ -87,7 +87,7 @@
@Test
public void getProjectsInScope_ignoreSourceManifest() throws Exception {
defaultSetup("alternate.config");
- Set<String> expectedProjects = new HashSet<String>();
+ Set<String> expectedProjects = new HashSet<>();
expectedProjects.add("platform/whee");
expectedProjects.add("whuu");
assertThat(configLoader.getProjectsInScope("master", "ds_two")).isEqualTo(expectedProjects);
@@ -150,7 +150,7 @@
@Test
public void upstreamBranchesTest() throws Exception {
defaultSetup("automerger.config");
- Set<String> expectedBranches = new HashSet<String>();
+ Set<String> expectedBranches = new HashSet<>();
expectedBranches.add("master");
assertThat(configLoader.getUpstreamBranches("ds_two", "platform/some/project"))
.isEqualTo(expectedBranches);
@@ -159,7 +159,7 @@
@Test
public void upstreamBranchesTest_nonexistentBranch() throws Exception {
defaultSetup("automerger.config");
- Set<String> expectedBranches = new HashSet<String>();
+ Set<String> expectedBranches = new HashSet<>();
assertThat(configLoader.getUpstreamBranches("master", "platform/some/project"))
.isEqualTo(expectedBranches);
}
@@ -167,7 +167,7 @@
@Test
public void downstreamBranchesTest() throws Exception {
defaultSetup("automerger.config");
- Set<String> expectedBranches = new HashSet<String>();
+ Set<String> expectedBranches = new HashSet<>();
expectedBranches.add("ds_two");
assertThat(configLoader.getDownstreamBranches("master", "platform/some/project"))
.isEqualTo(expectedBranches);
@@ -176,7 +176,7 @@
@Test
public void downstreamBranchesTest_nonexistentBranch() throws Exception {
defaultSetup("automerger.config");
- Set<String> expectedBranches = new HashSet<String>();
+ Set<String> expectedBranches = new HashSet<>();
assertThat(configLoader.getDownstreamBranches("idontexist", "platform/some/project"))
.isEqualTo(expectedBranches);
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/FailedMergeExceptionTest.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/FailedMergeExceptionTest.java
index f7c0cdc..b3e6ba4 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/FailedMergeExceptionTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/FailedMergeExceptionTest.java
@@ -35,7 +35,7 @@
@Before
public void setUp() throws Exception {
- failedMergeBranches = new TreeMap<String, String>();
+ failedMergeBranches = new TreeMap<>();
failedMergeBranches.put("branch1", "branch1 merge conflict");
failedMergeBranches.put("branch2", "branch2 merge conflict");
failedMergeBranches.put("branch3", "branch3 merge conflict");
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java
index faeffa8..256b798 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java
@@ -39,7 +39,7 @@
@Test
public void basicParseTest() throws Exception {
- Set<String> expectedSet = new HashSet<String>();
+ Set<String> expectedSet = new HashSet<>();
expectedSet.add("platform/whee");
expectedSet.add("whoo");
assertThat(manifestReader.getProjects()).isEqualTo(expectedSet);
@@ -48,7 +48,7 @@
@Test
public void branchDifferentFromDefaultRevisionTest() throws Exception {
ManifestReader aospManifestReader = new ManifestReader("mirror-aosp-master", manifestString);
- Set<String> expectedSet = new HashSet<String>();
+ Set<String> expectedSet = new HashSet<>();
expectedSet.add("platform/whaa");
assertThat(aospManifestReader.getProjects()).isEqualTo(expectedSet);
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
index 60001a5..0608d63 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
@@ -190,7 +190,7 @@
}
private List<ChangeInfo> sortedChanges(List<ChangeInfo> changes) {
- List<ChangeInfo> listCopy = new ArrayList<ChangeInfo>(changes);
+ List<ChangeInfo> listCopy = new ArrayList<>(changes);
Collections.sort(
listCopy,
new Comparator<ChangeInfo>() {