diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/ProjectAccessUtil.java b/gerrit-common/src/main/java/com/google/gerrit/common/ProjectAccessUtil.java index 12e47b1ee6..5e297d4443 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/ProjectAccessUtil.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/ProjectAccessUtil.java @@ -25,9 +25,8 @@ import java.util.Map; import java.util.Set; public class ProjectAccessUtil { - public static List mergeSections(final List src) { - final Map map = - new LinkedHashMap(); + public static List mergeSections(List src) { + Map map = new LinkedHashMap<>(); for (final AccessSection section : src) { if (section.getPermissions().isEmpty()) { continue; @@ -40,14 +39,14 @@ public class ProjectAccessUtil { map.put(section.getName(), section); } } - return new ArrayList(map.values()); + return new ArrayList<>(map.values()); } public static List removeEmptyPermissionsAndSections( final List src) { - final Set sectionsToRemove = new HashSet(); + final Set sectionsToRemove = new HashSet<>(); for (final AccessSection section : src) { - final Set permissionsToRemove = new HashSet(); + final Set permissionsToRemove = new HashSet<>(); for (final Permission permission : section.getPermissions()) { if (permission.getRules().isEmpty()) { permissionsToRemove.add(permission); diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccessSection.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccessSection.java index 5ddf1ae249..9a222ed231 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccessSection.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccessSection.java @@ -39,13 +39,13 @@ public class AccessSection extends RefConfigSection implements public List getPermissions() { if (permissions == null) { - permissions = new ArrayList(); + permissions = new ArrayList<>(); } return permissions; } public void setPermissions(List list) { - Set names = new HashSet(); + Set names = new HashSet<>(); for (Permission p : list) { if (!names.add(p.getName().toLowerCase())) { throw new IllegalArgumentException(); @@ -124,7 +124,7 @@ public class AccessSection extends RefConfigSection implements if (!super.equals(obj) || !(obj instanceof AccessSection)) { return false; } - return new HashSet(getPermissions()).equals(new HashSet( + return new HashSet(getPermissions()).equals(new HashSet<>( ((AccessSection) obj).getPermissions())); } } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java index 042d08dfad..d7803c1a41 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java @@ -39,7 +39,7 @@ public class AccountInfoCache { } public AccountInfoCache(final Iterable list) { - accounts = new HashMap(); + accounts = new HashMap<>(); for (final AccountInfo ai : list) { accounts.put(ai.getId(), ai); } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java index 36a9814030..f09241d404 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java @@ -30,7 +30,7 @@ import java.util.Set; public class ApprovalDetail { public static List sort(Collection ads, final int owner) { - List sorted = new ArrayList(ads); + List sorted = new ArrayList<>(ads); Collections.sort(sorted, new Comparator() { public int compare(ApprovalDetail o1, ApprovalDetail o2) { int byOwner = (o2.account.get() == owner ? 1 : 0) @@ -56,7 +56,7 @@ public class ApprovalDetail { public ApprovalDetail(final Account.Id id) { account = id; - approvals = new ArrayList(); + approvals = new ArrayList<>(); } public Account.Id getAccount() { @@ -73,7 +73,7 @@ public class ApprovalDetail { public void approved(String label) { if (approved == null) { - approved = new HashSet(); + approved = new HashSet<>(); } approved.add(label); hasNonZero = 1; @@ -81,7 +81,7 @@ public class ApprovalDetail { public void rejected(String label) { if (rejected == null) { - rejected = new HashSet(); + rejected = new HashSet<>(); } rejected.add(label); hasNonZero = 1; @@ -89,14 +89,14 @@ public class ApprovalDetail { public void votable(String label) { if (votable == null) { - votable = new HashSet(); + votable = new HashSet<>(); } votable.add(label); } public void value(String label, int value) { if (values == null) { - values = new HashMap(); + values = new HashMap<>(); } values.put(label, value); if (value != 0) { diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java index 30fa5495ce..db78c4d2dc 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java @@ -33,9 +33,9 @@ public class CommentDetail { private transient Map> forA; private transient Map> forB; - public CommentDetail(final PatchSet.Id idA, final PatchSet.Id idB) { - this.a = new ArrayList(); - this.b = new ArrayList(); + public CommentDetail(PatchSet.Id idA, PatchSet.Id idB) { + this.a = new ArrayList<>(); + this.b = new ArrayList<>(); this.idA = idA; this.idB = idB; } @@ -121,18 +121,18 @@ public class CommentDetail { // possible for several comments to have the same parent (this can happen if two reviewers // click Reply on the same comment at the same time). Such comments will be displayed under // their correct parent in chronological order. - Map> parentMap = new HashMap>(); + Map> parentMap = new HashMap<>(); // It's possible to have more than one root comment if two reviewers create a comment on the // same line at the same time - List rootComments = new ArrayList(); + List rootComments = new ArrayList<>(); // Store all the comments in parentMap, keyed by their parent for (PatchLineComment c : comments) { String parentUuid = c.getParentUuid(); List l = parentMap.get(parentUuid); if (l == null) { - l = new ArrayList(); + l = new ArrayList<>(); parentMap.put(parentUuid, l); } l.add(c); @@ -141,7 +141,7 @@ public class CommentDetail { // Add the comments in the list, starting with the head and then going through all the // comments that have it as a parent, and so on - List result = new ArrayList(); + List result = new ArrayList<>(); addChildren(parentMap, rootComments, result); return result; @@ -161,14 +161,12 @@ public class CommentDetail { } private Map> index( - final List in) { - final HashMap> r; - - r = new HashMap>(); + List in) { + HashMap> r = new HashMap<>(); for (final PatchLineComment p : in) { List l = r.get(p.getLine()); if (l == null) { - l = new ArrayList(); + l = new ArrayList<>(); r.put(p.getLine(), l); } l.add(p); diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ContributorAgreement.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ContributorAgreement.java index e02d9d377e..d475980a3e 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ContributorAgreement.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/ContributorAgreement.java @@ -54,7 +54,7 @@ public class ContributorAgreement implements Comparable { public List getAccepted() { if (accepted == null) { - accepted = new ArrayList(); + accepted = new ArrayList<>(); } return accepted; } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GarbageCollectionResult.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GarbageCollectionResult.java index e4d7b8008b..a052f4f306 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GarbageCollectionResult.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GarbageCollectionResult.java @@ -23,7 +23,7 @@ public class GarbageCollectionResult { protected List errors; public GarbageCollectionResult() { - errors = new ArrayList(); + errors = new ArrayList<>(); } public void addError(Error e) { diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GlobalCapability.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GlobalCapability.java index 1fd98b6285..9a6728e43c 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GlobalCapability.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GlobalCapability.java @@ -92,7 +92,7 @@ public class GlobalCapability { private static final List NAMES_LC; static { - NAMES_ALL = new ArrayList(); + NAMES_ALL = new ArrayList<>(); NAMES_ALL.add(ACCESS_DATABASE); NAMES_ALL.add(ADMINISTRATE_SERVER); NAMES_ALL.add(CREATE_ACCOUNT); @@ -110,7 +110,7 @@ public class GlobalCapability { NAMES_ALL.add(VIEW_CONNECTIONS); NAMES_ALL.add(VIEW_QUEUE); - NAMES_LC = new ArrayList(NAMES_ALL.size()); + NAMES_LC = new ArrayList<>(NAMES_ALL.size()); for (String name : NAMES_ALL) { NAMES_LC.add(name.toLowerCase()); } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java index e1777089d7..b700853c66 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java @@ -39,7 +39,7 @@ public class GroupInfoCache { } public GroupInfoCache(final Iterable list) { - groups = new HashMap(); + groups = new HashMap<>(); for (final GroupInfo gi : list) { groups.put(gi.getId(), gi); } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelType.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelType.java index f379b7c824..c596c1eecc 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelType.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelType.java @@ -27,7 +27,7 @@ import java.util.Map; public class LabelType { public static LabelType withDefaultValues(String name) { checkName(name); - List values = new ArrayList(2); + List values = new ArrayList<>(2); values.add(new LabelValue((short) 0, "Rejected")); values.add(new LabelValue((short) 1, "Approved")); return new LabelType(name, values); @@ -75,7 +75,7 @@ public class LabelType { } private static List sortValues(List values) { - values = new ArrayList(values); + values = new ArrayList<>(values); if (values.size() <= 1) { return Collections.unmodifiableList(values); } @@ -88,7 +88,7 @@ public class LabelType { short max = values.get(values.size() - 1).getValue(); short v = min; short i = 0; - List result = new ArrayList(max - min + 1); + List result = new ArrayList<>(max - min + 1); // Fill in any missing values with empty text. while (i < values.size()) { while (v < values.get(i).getValue()) { @@ -252,7 +252,7 @@ public class LabelType { private void initByValue() { if (byValue == null) { - byValue = new HashMap(); + byValue = new HashMap<>(); for (final LabelValue v : values) { byValue.put(v.getValue(), v); } @@ -261,7 +261,7 @@ public class LabelType { public List getValuesAsList() { if (intList == null) { - intList = new ArrayList(values.size()); + intList = new ArrayList<>(values.size()); for (LabelValue v : values) { intList.add(Integer.valueOf(v.getValue())); } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelTypes.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelTypes.java index a81254673c..b47445e601 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelTypes.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/LabelTypes.java @@ -52,7 +52,7 @@ public class LabelTypes { if (byLabel == null) { synchronized (this) { if (byLabel == null) { - Map l = new HashMap(); + Map l = new HashMap<>(); if (labelTypes != null) { for (LabelType t : labelTypes) { l.put(t.getName().toLowerCase(), t); @@ -95,7 +95,7 @@ public class LabelTypes { if (positions == null) { synchronized (this) { if (positions == null) { - Map p = new HashMap(); + Map p = new HashMap<>(); if (labelTypes != null) { int i = 0; for (LabelType t : labelTypes) { diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ParameterizedString.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ParameterizedString.java index 5a4bc8516c..454324b788 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ParameterizedString.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/ParameterizedString.java @@ -46,8 +46,8 @@ public class ParameterizedString { public ParameterizedString(final String pattern) { final StringBuilder raw = new StringBuilder(); - final List prs = new ArrayList(4); - final List ops = new ArrayList(4); + final List prs = new ArrayList<>(4); + final List ops = new ArrayList<>(4); int i = 0; while (i < pattern.length()) { @@ -95,7 +95,7 @@ public class ParameterizedString { /** Get the list of parameter names, ordered by appearance in the pattern. */ public List getParameterNames() { - final ArrayList r = new ArrayList(parameters.size()); + final ArrayList r = new ArrayList<>(parameters.size()); for (Parameter p : parameters) { r.add(p.name); } @@ -132,7 +132,7 @@ public class ParameterizedString { } public final class Builder { - private final Map params = new HashMap(); + private final Map params = new HashMap<>(); public Builder replace(final String name, final String value) { params.put(name, value); @@ -169,7 +169,7 @@ public class ParameterizedString { Parameter(final String parameter) { // "parameter[.functions...]" -> (parameter, functions...) final List names = Arrays.asList(parameter.split("\\.")); - final List functs = new ArrayList(names.size()); + final List functs = new ArrayList<>(names.size()); if (names.isEmpty()) { name = ""; @@ -207,7 +207,7 @@ public class ParameterizedString { private static final Map FUNCTIONS = initFunctions(); private static Map initFunctions() { - final HashMap m = new HashMap(); + HashMap m = new HashMap<>(); m.put("toLowerCase", new Function() { @Override String apply(String a) { diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/PermissionRange.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/PermissionRange.java index 0363fd6d36..7be8e4e2f1 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/PermissionRange.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/PermissionRange.java @@ -45,7 +45,7 @@ public class PermissionRange implements Comparable { /** @return all values between {@link #getMin()} and {@link #getMax()} */ public List getValuesAsList() { - ArrayList r = new ArrayList(getRangeSize()); + ArrayList r = new ArrayList<>(getRangeSize()); for (int i = min; i <= max; i++) { r.add(i); } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewResult.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewResult.java index 1c87c71e84..f82f434479 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewResult.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewResult.java @@ -27,7 +27,7 @@ public class ReviewResult { protected Change.Id changeId; public ReviewResult() { - errors = new ArrayList(); + errors = new ArrayList<>(); } public void addError(final Error e) { diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java index d85095ad6b..d696137982 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java @@ -28,7 +28,7 @@ public class ReviewerResult { protected boolean askForConfirmation; public ReviewerResult() { - errors = new ArrayList(); + errors = new ArrayList<>(); } public void addError(final Error e) { diff --git a/gerrit-common/src/test/java/com/google/gerrit/common/data/ParameterizedStringTest.java b/gerrit-common/src/test/java/com/google/gerrit/common/data/ParameterizedStringTest.java index 50002114d3..615f49f2e8 100644 --- a/gerrit-common/src/test/java/com/google/gerrit/common/data/ParameterizedStringTest.java +++ b/gerrit-common/src/test/java/com/google/gerrit/common/data/ParameterizedStringTest.java @@ -31,7 +31,7 @@ public class ParameterizedStringTest { assertEquals("", p.getRawPattern()); assertTrue(p.getParameterNames().isEmpty()); - final Map a = new HashMap(); + final Map a = new HashMap<>(); assertNotNull(p.bind(a)); assertEquals(0, p.bind(a).length); assertEquals("", p.replace(a)); @@ -44,7 +44,7 @@ public class ParameterizedStringTest { assertEquals("${bar}c", p.getRawPattern()); assertTrue(p.getParameterNames().isEmpty()); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("bar", "frobinator"); assertNotNull(p.bind(a)); assertEquals(0, p.bind(a).length); @@ -59,7 +59,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("bar")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("bar", "frobinator"); assertNotNull(p.bind(a)); assertEquals(1, p.bind(a).length); @@ -75,7 +75,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("bar")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("bar", "frobinator"); assertNotNull(p.bind(a)); assertEquals(1, p.bind(a).length); @@ -91,7 +91,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("bar")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("bar", "frobinator"); assertNotNull(p.bind(a)); assertEquals(1, p.bind(a).length); @@ -107,7 +107,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("bar")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); assertNotNull(p.bind(a)); assertEquals(1, p.bind(a).length); assertEquals("", p.bind(a)[0]); @@ -120,7 +120,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "foo"); assertNotNull(p.bind(a)); @@ -141,7 +141,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "foo"); assertNotNull(p.bind(a)); @@ -162,7 +162,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "foo@example.com"); assertNotNull(p.bind(a)); @@ -186,7 +186,7 @@ public class ParameterizedStringTest { assertTrue(p.getParameterNames().contains("userName")); assertTrue(p.getParameterNames().contains("email")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("userName", "firstName lastName"); a.put("email", "FIRSTNAME.LASTNAME@EXAMPLE.COM"); assertNotNull(p.bind(a)); @@ -204,7 +204,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "FOO@EXAMPLE.COM"); assertNotNull(p.bind(a)); @@ -226,7 +226,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "foo@example.com"); assertNotNull(p.bind(a)); @@ -248,7 +248,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "foo@example.com"); assertNotNull(p.bind(a)); @@ -270,7 +270,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "foo@example.com"); assertNotNull(p.bind(a)); @@ -292,7 +292,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "FOO@EXAMPLE.COM"); assertNotNull(p.bind(a)); @@ -314,7 +314,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "FOO@EXAMPLE.COM"); assertNotNull(p.bind(a)); @@ -336,7 +336,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "FOO@EXAMPLE.COM"); assertNotNull(p.bind(a)); @@ -358,7 +358,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "FOO@EXAMPLE.COM"); assertNotNull(p.bind(a)); @@ -380,7 +380,7 @@ public class ParameterizedStringTest { assertEquals(1, p.getParameterNames().size()); assertTrue(p.getParameterNames().contains("a")); - final Map a = new HashMap(); + final Map a = new HashMap<>(); a.put("a", "foo@example.com"); assertNotNull(p.bind(a)); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java index b0d68e1546..aaa902c34f 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java @@ -571,7 +571,7 @@ public class Gerrit implements EntryPoint { menuLeft.clear(); menuRight.clear(); - menuBars = new HashMap(); + menuBars = new HashMap<>(); final boolean signedIn = isSignedIn(); final GerritConfig cfg = getConfig(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GitwebLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GitwebLink.java index 73feb766a4..e32a6027b1 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GitwebLink.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GitwebLink.java @@ -56,7 +56,7 @@ public class GitwebLink { public String toRevision(String project, String commit) { ParameterizedString pattern = new ParameterizedString(type.getRevision()); - Map p = new HashMap(); + Map p = new HashMap<>(); p.put("project", encode(project)); p.put("commit", encode(commit)); return baseUrl + pattern.replace(p); @@ -69,7 +69,7 @@ public class GitwebLink { public String toProject(final Project.NameKey project) { ParameterizedString pattern = new ParameterizedString(type.getProject()); - final Map p = new HashMap(); + final Map p = new HashMap<>(); p.put("project", encode(project.get())); return baseUrl + pattern.replace(p); } @@ -77,14 +77,14 @@ public class GitwebLink { public String toBranch(final Branch.NameKey branch) { ParameterizedString pattern = new ParameterizedString(type.getBranch()); - final Map p = new HashMap(); + final Map p = new HashMap<>(); p.put("project", encode(branch.getParentKey().get())); p.put("branch", encode(branch.get())); return baseUrl + pattern.replace(p); } public String toFile(String project, String commit, String file) { - Map p = new HashMap(); + Map p = new HashMap<>(); p.put("project", encode(project)); p.put("commit", encode(commit)); p.put("file", encode(file)); @@ -98,7 +98,7 @@ public class GitwebLink { public String toFileHistory(final Branch.NameKey branch, final String file) { ParameterizedString pattern = new ParameterizedString(type.getFileHistory()); - final Map p = new HashMap(); + final Map p = new HashMap<>(); p.put("project", encode(branch.getParentKey().get())); p.put("branch", encode(branch.get())); p.put("file", encode(file)); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java index cd473fb295..0715aee143 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java @@ -39,8 +39,7 @@ public class SearchSuggestOracle extends HighlightSuggestOracle { final Response response) { if ("self".startsWith(request.getQuery())) { final ArrayList r = - new ArrayList(response - .getSuggestions().size() + 1); + new ArrayList<>(response.getSuggestions().size() + 1); r.addAll(response.getSuggestions()); r.add(new SuggestOracle.Suggestion() { @Override @@ -62,7 +61,7 @@ public class SearchSuggestOracle extends HighlightSuggestOracle { new ParamSuggester(Arrays.asList("ownerin:", "reviewerin:"), new AccountGroupSuggestOracle())); - private static final TreeSet suggestions = new TreeSet(); + private static final TreeSet suggestions = new TreeSet<>(); static { suggestions.add("age:"); @@ -124,7 +123,7 @@ public class SearchSuggestOracle extends HighlightSuggestOracle { @Override public void requestDefaultSuggestions(Request request, Callback done) { - final ArrayList r = new ArrayList(); + final ArrayList r = new ArrayList<>(); // No text - show some default suggestions. r.add(new SearchSuggestion("status:open", "status:open")); r.add(new SearchSuggestion("age:1week", "age:1week")); @@ -152,7 +151,7 @@ public class SearchSuggestOracle extends HighlightSuggestOracle { } } - final ArrayList r = new ArrayList(); + final ArrayList r = new ArrayList<>(); for (String suggestion : suggestions.tailSet(lastWord)) { if ((lastWord.length() < suggestion.length()) && suggestion.startsWith(lastWord)) { if (suggestion.contains("self") && !Gerrit.isSignedIn()) { @@ -240,8 +239,7 @@ public class SearchSuggestOracle extends HighlightSuggestOracle { final Response response) { final String query = request.getQuery(); final List r = - new ArrayList(response - .getSuggestions().size()); + new ArrayList<>(response.getSuggestions().size()); for (final SearchSuggestOracle.Suggestion s : response .getSuggestions()) { r.add(new SearchSuggestion(s.getDisplayString(), diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyIdentitiesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyIdentitiesScreen.java index ca872cce05..4703ef7e24 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyIdentitiesScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyIdentitiesScreen.java @@ -106,8 +106,7 @@ public class MyIdentitiesScreen extends SettingsScreen { } void deleteChecked() { - final HashSet keys = - new HashSet(); + final HashSet keys = new HashSet<>(); for (int row = 1; row < table.getRowCount(); row++) { final AccountExternalId k = getRowItem(row); if (k == null) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchesTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchesTable.java index 9f248ee88d..6c12e99b3a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchesTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchesTable.java @@ -87,8 +87,7 @@ public class MyWatchesTable extends FancyFlexTable { } protected Set getCheckedIds() { - final Set ids = - new HashSet(); + final Set ids = new HashSet<>(); for (int row = 1; row < table.getRowCount(); row++) { final AccountProjectWatchInfo k = getRowItem(row); if (k != null && ((CheckBox) table.getWidget(row, 1)).getValue()) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/NewAgreementScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/NewAgreementScreen.java index ac44dbebc7..275937eed5 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/NewAgreementScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/NewAgreementScreen.java @@ -81,7 +81,7 @@ public class NewAgreementScreen extends AccountScreen { Util.ACCOUNT_SVC.myAgreements(new GerritCallback() { public void onSuccess(AgreementInfo result) { if (isAttached()) { - mySigned = new HashSet(result.accepted); + mySigned = new HashSet<>(result.accepted); postRPC(); } } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshPanel.java index 0dfb520cb9..fb1ed8ba8a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshPanel.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshPanel.java @@ -259,7 +259,7 @@ class SshPanel extends Composite { } void deleteChecked() { - final HashSet sequenceNumbers = new HashSet(); + final HashSet sequenceNumbers = new HashSet<>(); for (int row = 1; row < table.getRowCount(); row++) { final SshKeyInfo k = getRowItem(row); if (k != null && ((CheckBox) table.getWidget(row, 1)).getValue()) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.java index b734b41ffd..3a0d2f7b4a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.java @@ -218,7 +218,7 @@ public class AccessSectionEditor extends Composite implements } private void rebuildPermissionSelector() { - List perms = new ArrayList(); + List perms = new ArrayList<>(); if (AccessSection.GLOBAL_CAPABILITIES.equals(value.getName())) { for (String varName : projectAccess.getCapabilities().keySet()) { @@ -261,7 +261,7 @@ public class AccessSectionEditor extends Composite implements @Override public void flush() { List src = permissions.getList(); - List keep = new ArrayList(src.size()); + List keep = new ArrayList<>(src.size()); for (int i = 0; i < src.size(); i++) { PermissionEditor e = (PermissionEditor) permissionContainer.getWidget(i); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java index 31bae1a7f4..df74a41c6e 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java @@ -238,7 +238,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen { } void deleteChecked() { - final HashSet ids = new HashSet(); + final HashSet ids = new HashSet<>(); for (int row = 1; row < table.getRowCount(); row++) { final AccountInfo i = getRowItem(row); if (i != null && ((CheckBox) table.getWidget(row, 1)).getValue()) { @@ -343,7 +343,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen { } void deleteChecked() { - final HashSet ids = new HashSet(); + final HashSet ids = new HashSet<>(); for (int row = 1; row < table.getRowCount(); row++) { final GroupInfo i = getRowItem(row); if (i != null && ((CheckBox) table.getWidget(row, 1)).getValue()) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.java index f8119b46c9..efb2fb405d 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.java @@ -295,7 +295,7 @@ public class PermissionEditor extends Composite implements Editor, @Override public void flush() { List src = rules.getList(); - List keep = new ArrayList(src.size()); + List keep = new ArrayList<>(src.size()); for (int i = 0; i < src.size(); i++) { PermissionRuleEditor e = diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionNameRenderer.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionNameRenderer.java index d8ee195f7f..7ca8f0f4c0 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionNameRenderer.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionNameRenderer.java @@ -25,7 +25,7 @@ class PermissionNameRenderer implements Renderer { private static final Map permissions; static { - permissions = new HashMap(); + permissions = new HashMap<>(); for (Map.Entry e : Util.C.permissionNames().entrySet()) { permissions.put(e.getKey(), e.getValue()); permissions.put(e.getKey().toLowerCase(), e.getValue()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.java index 1d7b960068..8981e8282b 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.java @@ -137,7 +137,7 @@ public class ProjectAccessEditor extends Composite implements @Override public void flush() { List src = local.getList(); - List keep = new ArrayList(src.size()); + List keep = new ArrayList<>(src.size()); for (int i = 0; i < src.size(); i++) { AccessSectionEditor e = (AccessSectionEditor) localContainer.getWidget(i); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.java index 32d3405303..9c6cc1d1a7 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.java @@ -145,7 +145,7 @@ public class ProjectAccessScreen extends ProjectScreen { private void displayReadOnly(ProjectAccess access) { this.access = access; - Map allCapabilities = new HashMap(); + Map allCapabilities = new HashMap<>(); for (CapabilityInfo c : Natives.asList(capabilityMap.values())) { allCapabilities.put(c.id(), c.name()); } @@ -233,17 +233,16 @@ public class ProjectAccessScreen extends ProjectScreen { ProjectAccess newAccess) { final List wantedSections = mergeSections(removeEmptyPermissionsAndSections(wantedAccess.getLocal())); - final HashSet same = - new HashSet(wantedSections); + final HashSet same = new HashSet<>(wantedSections); final HashSet different = - new HashSet(wantedSections.size() + new HashSet<>(wantedSections.size() + newAccess.getLocal().size()); different.addAll(wantedSections); different.addAll(newAccess.getLocal()); same.retainAll(newAccess.getLocal()); different.removeAll(same); - final Set differentNames = new HashSet(); + final Set differentNames = new HashSet<>(); for (final AccessSection s : different) { differentNames.add(s.getName()); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java index d84f9314c7..a70aa8f2c5 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java @@ -249,7 +249,7 @@ public class ProjectBranchesScreen extends ProjectScreen { } Set getCheckedRefs() { - Set refs = new HashSet(); + Set refs = new HashSet<>(); for (int row = 1; row < table.getRowCount(); row++) { final BranchInfo k = getRowItem(row); if (k != null && table.getWidget(row, 1) instanceof CheckBox diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java index 0de08f4b6a..28010f8195 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java @@ -353,10 +353,10 @@ public class ProjectInfoScreen extends ProjectScreen { private void initPluginOptions(ConfigInfo info) { pluginOptionsPanel.clear(); - pluginConfigWidgets = new HashMap>(); + pluginConfigWidgets = new HashMap<>(); for (String pluginName : info.pluginConfig().keySet()) { - Map widgetMap = new HashMap(); + Map widgetMap = new HashMap<>(); pluginConfigWidgets.put(pluginName, widgetMap); LabeledWidgetsGrid g = new LabeledWidgetsGrid(); g.addHeader(new SmallHeading(Util.M.pluginProjectOptionsTitle(pluginName))); @@ -543,7 +543,7 @@ public class ProjectInfoScreen extends ProjectScreen { private Map> getPluginConfigValues() { Map> pluginConfigValues = - new HashMap>(pluginConfigWidgets.size()); + new HashMap<>(pluginConfigWidgets.size()); for (Entry> e : pluginConfigWidgets.entrySet()) { Map values = new HashMap(e.getValue().size()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.java index 4dc7aa4469..f927dd1782 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.java @@ -130,7 +130,7 @@ class Actions extends Composite { } private static TreeSet filterNonCore(NativeMap m) { - TreeSet ids = new TreeSet(m.keySet()); + TreeSet ids = new TreeSet<>(m.keySet()); for (String id : CORE) { ids.remove(id); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java index 3d0870f70f..4c3103a64b 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java @@ -123,7 +123,7 @@ public class ChangeScreen2 extends Screen { private KeyCommandSet keysNavigation; private KeyCommandSet keysAction; - private List handlers = new ArrayList(4); + private List handlers = new ArrayList<>(4); private UpdateCheckTimer updateCheck; private Timestamp lastDisplayedUpdate; private UpdateAvailableBar updateAvailable; @@ -618,8 +618,7 @@ public class ChangeScreen2 extends Screen { private List>> loadComments( RevisionInfo rev, CallbackGroup group) { final int id = rev._number(); - final List>> r = - new ArrayList>>(1); + final List>> r = new ArrayList<>(1); ChangeApi.revision(changeId.get(), rev.name()) .view("comments") .get(group.add(new AsyncCallback>>() { @@ -638,8 +637,7 @@ public class ChangeScreen2 extends Screen { private List>> loadDrafts( RevisionInfo rev, CallbackGroup group) { - final List>> r = - new ArrayList>>(1); + final List>> r = new ArrayList<>(1); if (Gerrit.isSignedIn()) { ChangeApi.revision(changeId.get(), rev.name()) .view("drafts") diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java index 62652de5d4..36be692a30 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java @@ -43,11 +43,11 @@ class History extends FlowPanel { private ReplyAction replyAction; private Change.Id changeId; - private final Set loaded = new HashSet(); + private final Set loaded = new HashSet<>(); private final Map> byAuthor = - new HashMap>(); + new HashMap<>(); - private final List toLoad = new ArrayList(4); + private final List toLoad = new ArrayList<>(4); private int active; void set(CommentLinkProcessor clp, ReplyAction ra, @@ -109,7 +109,7 @@ class History extends FlowPanel { AuthorRevision k = new AuthorRevision(c.author(), id); List l = byAuthor.get(k); if (l == null) { - l = new ArrayList(); + l = new ArrayList<>(); byAuthor.put(k, l); } l.add(c); @@ -175,8 +175,8 @@ class History extends FlowPanel { } Timestamp when = msg.date(); - List match = new ArrayList(); - List other = new ArrayList(); + List match = new ArrayList<>(); + List other = new ArrayList<>(); for (CommentInfo c : list) { if (c.updated().compareTo(when) <= 0) { match.add(c); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Labels.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Labels.java index 773a1fa77a..0be0b5de84 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Labels.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Labels.java @@ -100,7 +100,7 @@ class Labels extends Grid { } boolean set(ChangeInfo info, boolean current) { - List names = new ArrayList(info.labels()); + List names = new ArrayList<>(info.labels()); Collections.sort(names); boolean canSubmit = info.status().isOpen(); @@ -140,14 +140,14 @@ class Labels extends Grid { } private Widget renderUsers(LabelInfo label) { - Map> m = new HashMap>(4); + Map> m = new HashMap<>(4); int approved = 0, rejected = 0; for (ApprovalInfo ai : Natives.asList(label.all())) { if (ai.value() != 0) { List l = m.get(Integer.valueOf(ai.value())); if (l == null) { - l = new ArrayList(label.all().length()); + l = new ArrayList<>(label.all().length()); m.put(Integer.valueOf(ai.value()), l); } l.add(ai); @@ -183,7 +183,7 @@ class Labels extends Grid { } private static List sort(Set keySet, int a, int b) { - List r = new ArrayList(keySet); + List r = new ArrayList<>(keySet); Collections.sort(r); if (keySet.contains(a)) { r.remove(Integer.valueOf(a)); @@ -223,7 +223,7 @@ class Labels extends Grid { static SafeHtml formatUserList(ChangeScreen2.Style style, Collection in, Set removable) { - List users = new ArrayList(in); + List users = new ArrayList<>(in); Collections.sort(users, new Comparator() { @Override public int compare(AccountInfo a, AccountInfo b) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.java index e81a9aebb4..e3799cad12 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.java @@ -179,12 +179,11 @@ class Message extends Composite { private static TreeMap> byPath(List list) { - TreeMap> m = - new TreeMap>(); + TreeMap> m = new TreeMap<>(); for (CommentInfo c : list) { List l = m.get(c.path()); if (l == null) { - l = new ArrayList(); + l = new ArrayList<>(); m.put(c.path(), l); } l.add(c); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java index 49159a40f2..ab90eba06e 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java @@ -133,7 +133,7 @@ public class RelatedChanges extends TabPanel { private int outstandingCallbacks; RelatedChanges() { - tabs = new ArrayList(Tab.values().length); + tabs = new ArrayList<>(Tab.values().length); selectedTab = -1; setVisible(false); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChangesTab.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChangesTab.java index f07adde47f..e1ce99d014 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChangesTab.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChangesTab.java @@ -163,7 +163,7 @@ class RelatedChangesTab implements IsWidget { this.revision = revision; this.changes = changes; this.navList = navList; - rows = new ArrayList(changes.length()); + rows = new ArrayList<>(changes.length()); connectedPos = changes.length() - 1; connected = showIndirectAncestors ? new HashSet(Math.max(changes.length() * 4 / 3, 16)) diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java index 77e68677aa..64dcd286e4 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java @@ -115,7 +115,7 @@ class ReplyBox extends Composite { this.revision = revision; initWidget(uiBinder.createAndBindUi(this)); - List names = new ArrayList(permitted.keySet()); + List names = new ArrayList<>(permitted.keySet()); if (names.isEmpty()) { UIObject.setVisible(labelsParent, false); } else { @@ -281,13 +281,12 @@ class ReplyBox extends Composite { List names, NativeMap all, NativeMap permitted) { - TreeSet values = new TreeSet(); - List labels = - new ArrayList(permitted.size()); + TreeSet values = new TreeSet<>(); + List labels = new ArrayList<>(permitted.size()); for (String id : names) { JsArrayString p = permitted.get(id); if (p != null) { - Set a = new TreeSet(); + Set a = new TreeSet<>(); for (int i = 0; i < p.length(); i++) { a.add(LabelInfo.parseValue(p.get(i))); } @@ -295,7 +294,7 @@ class ReplyBox extends Composite { values.addAll(a); } } - List columns = new ArrayList(values); + List columns = new ArrayList<>(values); labelsTable.resize(1 + labels.size(), 2 + values.size()); for (int c = 0; c < columns.size(); c++) { @@ -303,8 +302,7 @@ class ReplyBox extends Composite { labelsTable.getCellFormatter().setStyleName(0, 1 + c, style.label_value()); } - List checkboxes = - new ArrayList(labels.size()); + List checkboxes = new ArrayList<>(labels.size()); int row = 1; for (LabelAndValues lv : labels) { if (isCheckBox(lv.info.value_set())) { @@ -413,7 +411,7 @@ class ReplyBox extends Composite { Util.C.commitMessage(), copyPath(Patch.COMMIT_MSG, l))); } - List paths = new ArrayList(m.keySet()); + List paths = new ArrayList<>(m.keySet()); Collections.sort(paths); for (String path : paths) { @@ -452,7 +450,7 @@ class ReplyBox extends Composite { LabelRadioGroup(int row, String label, int cnt) { this.row = row; this.label = label; - this.buttons = new ArrayList(cnt); + this.buttons = new ArrayList<>(cnt); } void select(LabelRadioButton b) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RestReviewerSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RestReviewerSuggestOracle.java index 7575869f18..b5a3023350 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RestReviewerSuggestOracle.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RestReviewerSuggestOracle.java @@ -42,7 +42,7 @@ public class RestReviewerSuggestOracle extends SuggestAfterTypingNCharsOracle { @Override public void onSuccess(JsArray result) { final List r = - new ArrayList(result.length()); + new ArrayList<>(result.length()); for (final SuggestReviewerInfo reviewer : Natives.asList(result)) { r.add(new RestReviewerSuggestion(reviewer)); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.java index dcce37a18e..fb75627cc2 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.java @@ -209,8 +209,8 @@ class Reviewers extends Composite { } private void display(ChangeInfo info) { - Map r = new HashMap(); - Map cc = new HashMap(); + Map r = new HashMap<>(); + Map cc = new HashMap<>(); for (LabelInfo label : Natives.asList(info.all_labels().values())) { if (label.all() != null) { for (ApprovalInfo ai : Natives.asList(label.all())) { @@ -224,7 +224,7 @@ class Reviewers extends Composite { r.remove(info.owner()._account_id()); cc.remove(info.owner()._account_id()); - Set removable = new HashSet(); + Set removable = new HashSet<>(); if (info.removable_reviewers() != null) { for (AccountInfo a : Natives.asList(info.removable_reviewers())) { removable.add(a._account_id()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.java index 1dece8b936..2b6f418e31 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.java @@ -45,7 +45,7 @@ abstract class UpdateAvailableBar extends Composite { } void set(List newMessages, Timestamp newTime) { - HashSet seen = new HashSet(); + HashSet seen = new HashSet<>(); StringBuilder r = new StringBuilder(); for (MessageInfo m : newMessages) { int a = m.author() != null ? m.author()._account_id() : 0; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java index c14a5c9b14..0ac487bd58 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java @@ -71,7 +71,7 @@ public class ApprovalTable extends Composite { private Map rows; public ApprovalTable() { - rows = new HashMap(); + rows = new HashMap<>(); table = new Grid(1, 3); table.addStyleName(Gerrit.RESOURCES.css().infoTable()); @@ -138,10 +138,8 @@ public class ApprovalTable extends Composite { void display(ChangeInfo change) { lastChange = change; reviewerSuggestOracle.setChange(change.legacy_id()); - Map byUser = - new LinkedHashMap(); - Map accounts = - new LinkedHashMap(); + Map byUser = new LinkedHashMap<>(); + Map accounts = new LinkedHashMap<>(); List missingLabels = initLabels(change, accounts, byUser); removeAllChildren(missing.getElement()); @@ -152,7 +150,7 @@ public class ApprovalTable extends Composite { if (byUser.isEmpty()) { table.setVisible(false); } else { - List labels = new ArrayList(change.labels()); + List labels = new ArrayList<>(change.labels()); Collections.sort(labels); displayHeader(labels); table.resizeRows(1 + byUser.size()); @@ -187,7 +185,7 @@ public class ApprovalTable extends Composite { private Set removableReviewers(ChangeInfo change) { Set result = - new HashSet(change.removable_reviewers().length()); + new HashSet<>(change.removable_reviewers().length()); for (int i = 0; i < change.removable_reviewers().length(); i++) { result.add(change.removable_reviewers().get(i)._account_id()); } @@ -198,7 +196,7 @@ public class ApprovalTable extends Composite { Map accounts, Map byUser) { Set removableReviewers = removableReviewers(change); - List missing = new ArrayList(); + List missing = new ArrayList<>(); for (String name : change.labels()) { LabelInfo label = change.label(name); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java index 5a9da1a51d..7fd5290c6b 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java @@ -23,8 +23,7 @@ import java.util.Map; /** A Cache to store common client side data by change */ public class ChangeCache { - private static Map caches = - new HashMap(); + private static Map caches = new HashMap<>(); public static ChangeCache get(Change.Id chg) { ChangeCache cache = caches.get(chg); @@ -56,7 +55,7 @@ public class ChangeCache { public ListenableValue getChangeInfoCache() { if (info == null) { - info = new ListenableValue(); + info = new ListenableValue<>(); } return info; } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java index 5ee4bb97d7..d735bb5516 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java @@ -171,7 +171,7 @@ public class ChangeDetailCache extends ListenableValue { } public static AccountInfoCache users(ChangeInfo info) { - Map r = new HashMap(); + Map r = new HashMap<>(); add(r, info.owner()); if (info.messages() != null) { for (MessageInfo m : Natives.asList(info.messages())) { @@ -196,7 +196,7 @@ public class ChangeDetailCache extends ListenableValue { } private static List toMessages(ChangeInfo info) { - List msgs = new ArrayList(); + List msgs = new ArrayList<>(); for (MessageInfo m : Natives.asList(info.messages())) { ChangeMessage o = new ChangeMessage( new ChangeMessage.Key( @@ -219,7 +219,7 @@ public class ChangeDetailCache extends ListenableValue { JsArray all = info.revisions().values(); RevisionInfo.sortRevisionInfoByNumber(all); - List r = new ArrayList(all.length()); + List r = new ArrayList<>(all.length()); for (RevisionInfo rev : Natives.asList(all)) { r.add(toPatchSet(info, rev)); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfo.java index 1adee4982f..bc752cfa50 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfo.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfo.java @@ -173,7 +173,7 @@ public class ChangeInfo extends JavaScriptObject { } public final SortedSet value_set() { - SortedSet values = new TreeSet(); + SortedSet values = new TreeSet<>(); for (String v : values()) { values.add(parseValue(v)); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java index 10b94a45c1..e48448adf9 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable2.java @@ -71,7 +71,7 @@ public class ChangeTable2 extends NavigationTable { keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar())); } - sections = new ArrayList
(); + sections = new ArrayList<>(); table.setText(0, C_STAR, ""); table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject()); table.setText(0, C_STATUS, Util.C.changeTableColumnStatus()); @@ -157,7 +157,7 @@ public class ChangeTable2 extends NavigationTable { } public void updateColumnsForLabels(ChangeList... lists) { - labelNames = new ArrayList(); + labelNames = new ArrayList<>(); for (ChangeList list : lists) { for (int i = 0; i < list.length(); i++) { for (String name : list.get(i).labels()) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java index 1f17008ea3..34b6dee30b 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java @@ -35,8 +35,8 @@ public class DashboardTable extends ChangeTable2 { private List queries; public DashboardTable(String params) { - titles = new ArrayList(); - queries = new ArrayList(); + titles = new ArrayList<>(); + queries = new ArrayList<>(); String foreach = null; for (String kvPair : params.split("[,;&]")) { String[] kv = kvPair.split("=", 2); @@ -63,7 +63,7 @@ public class DashboardTable extends ChangeTable2 { addStyleName(Gerrit.RESOURCES.css().accountDashboard()); - sections = new ArrayList(); + sections = new ArrayList<>(); int i = 0; for (String title : titles) { Section s = new Section(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java index 63ba437ae2..62fbfb4f2e 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java @@ -89,7 +89,7 @@ public class IncludedInTable extends Composite implements } private List toList(JsArrayString in) { - List r = new ArrayList(); + List r = new ArrayList<>(); if (in != null) { for (int i = 0; i < in.length(); i++) { r.add(in.get(i)); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java index b097bd8049..be64a3d6e7 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java @@ -34,8 +34,7 @@ import java.util.Map; /** Supports the star icon displayed on changes and tracking the status. */ public class StarredChanges { - private static final Event.Type TYPE = - new Event.Type(); + private static final Event.Type TYPE = new Event.Type<>(); /** Handler that can receive notifications of a change's starred status. */ public static interface ChangeStarHandler { @@ -118,7 +117,7 @@ public class StarredChanges { private static boolean busy; private static final Map pending = - new LinkedHashMap(4); + new LinkedHashMap<>(4); private static void startRequest() { busy = true; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardsTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardsTable.java index 00721b75d8..3b168e129d 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardsTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardsTable.java @@ -60,7 +60,7 @@ public class DashboardsTable extends NavigationTable { } public void display(JsArray in) { - Map map = new HashMap(); + Map map = new HashMap<>(); for (DashboardList list : Natives.asList(in)) { for (DashboardInfo d : Natives.asList(list)) { if (!map.containsKey(d.id())) { @@ -68,7 +68,7 @@ public class DashboardsTable extends NavigationTable { } } } - display(new ArrayList(map.values())); + display(new ArrayList<>(map.values())); } public void display(List list) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ChunkManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ChunkManager.java index a079b82a4d..36bd64fbdc 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ChunkManager.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ChunkManager.java @@ -93,10 +93,10 @@ class ChunkManager { } void render(DiffInfo diff) { - chunks = new ArrayList(); - markers = new ArrayList(); - undo = new ArrayList(); - padding = new ArrayList(); + chunks = new ArrayList<>(); + markers = new ArrayList<>(); + undo = new ArrayList<>(); + padding = new ArrayList<>(); String diffColor = diff.meta_a() == null || diff.meta_b() == null ? DiffTable.style.intralineBg() diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentManager.java index 517b5ff34f..c082b8cad1 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentManager.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentManager.java @@ -62,10 +62,10 @@ class CommentManager { this.path = path; this.commentLinkProcessor = clp; - published = new HashMap(); - sideA = new TreeMap(); - sideB = new TreeMap(); - unsavedDrafts = new HashSet(); + published = new HashMap<>(); + sideA = new TreeMap<>(); + sideB = new TreeMap<>(); + unsavedDrafts = new HashSet<>(); } SideBySide2 getSideBySide2() { @@ -247,7 +247,7 @@ class CommentManager { // TODO: This is not optimal, but shouldn't be too costly in most cases. // Maybe rewrite after done keeping track of diff chunk positions. for (int boxLine : sideB.tailMap(1).keySet()) { - List temp = new ArrayList(skips.size() + 2); + List temp = new ArrayList<>(skips.size() + 2); for (SkippedLine skip : skips) { int startLine = skip.getStartB(); int deltaBefore = boxLine - startLine; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/LineMapper.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/LineMapper.java index 31b6baa2b2..6c7423cc4e 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/LineMapper.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/LineMapper.java @@ -32,8 +32,8 @@ class LineMapper { void reset() { lineA = 0; lineB = 0; - lineMapAtoB = new ArrayList(); - lineMapBtoA = new ArrayList(); + lineMapAtoB = new ArrayList<>(); + lineMapBtoA = new ArrayList<>(); } int getLineA() { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/OverviewBar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/OverviewBar.java index d16bf9a085..b9e6375080 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/OverviewBar.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/OverviewBar.java @@ -73,8 +73,8 @@ class OverviewBar extends Composite implements ClickHandler { OverviewBar() { initWidget(uiBinder.createAndBindUi(this)); - diff = new ArrayList(); - comments = new HashSet(); + diff = new ArrayList<>(); + comments = new HashSet<>(); addDomHandler(this, ClickEvent.getType()); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java index 1ed85c24b1..5c6aa29e2e 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide2.java @@ -129,7 +129,7 @@ public class SideBySide2 extends Screen { this.startLine = startLine; prefs = DiffPreferences.create(Gerrit.getAccountDiffPreference()); - handlers = new ArrayList(6); + handlers = new ArrayList<>(6); keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation()); header = new Header(keysNavigation, base, revision, path); diffTable = new DiffTable(this, base, revision, path); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipManager.java index 239c42a046..5ba275fd9e 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipManager.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipManager.java @@ -48,7 +48,7 @@ class SkipManager { } JsArray regions = diff.content(); - List skips = new ArrayList(); + List skips = new ArrayList<>(); int lineA = 0, lineB = 0; for (int i = 0; i < regions.length(); i++) { Region current = regions.get(i); @@ -78,7 +78,7 @@ class SkipManager { CodeMirror cmA = host.getCmFromSide(DisplaySide.A); CodeMirror cmB = host.getCmFromSide(DisplaySide.B); - skipBars = new HashSet(); + skipBars = new HashSet<>(); for (SkippedLine skip : skips) { SkipBar barA = newSkipBar(cmA, DisplaySide.A, skip); SkipBar barB = newSkipBar(cmB, DisplaySide.B, skip); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java index 8bc897f6a6..845537e8f5 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java @@ -158,7 +158,7 @@ public class DownloadUrlLink extends Anchor implements ClickHandler { public static List createDownloadUrlLinks(String project, String ref, boolean allowAnonymous) { - List urls = new ArrayList(); + List urls = new ArrayList<>(); Set allowedSchemes = Gerrit.getConfig().getDownloadSchemes(); if (allowAnonymous diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java index f120c1f891..26dd173a67 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java @@ -797,9 +797,8 @@ public abstract class AbstractPatchContentTable extends NavigationTable } protected static class CommentList { - final List comments = new ArrayList(); - final List panels = - new ArrayList(); + final List comments = new ArrayList<>(); + final List panels = new ArrayList<>(); } public static class NoOpKeyCommand extends NeedsSignInKeyCommand { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java index cb54411520..6875a96a0b 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java @@ -34,7 +34,7 @@ import java.util.List; */ class HistoryTable extends FancyFlexTable { private final PatchScreen screen; - final List all = new ArrayList(); + final List all = new ArrayList<>(); HistoryTable(final PatchScreen parent) { setStyleName(Gerrit.RESOURCES.css().patchHistoryTable()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java index c221f72135..2d58816952 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java @@ -93,7 +93,7 @@ public class SideBySideTable extends AbstractPatchContentTable { @Override protected void render(final PatchScript script, final PatchSetDetail detail) { - final ArrayList lines = new ArrayList(); + final ArrayList lines = new ArrayList<>(); final SafeHtmlBuilder nc = new SafeHtmlBuilder(); isHugeFile = script.isHugeFile(); allocateTableHeader(script, nc); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java index 629e73131e..9ec4a8b7a1 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java @@ -216,7 +216,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable { for (final String line : script.getPatchHeader()) { appendFileHeader(nc, line); } - final ArrayList lines = new ArrayList(); + final ArrayList lines = new ArrayList<>(); if (hasDifferences(script)) { if (script.getDisplayMethodA() == DisplayMethod.IMG @@ -357,7 +357,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable { } setAccountInfoCache(cd.getAccounts()); - final ArrayList all = new ArrayList(); + final ArrayList all = new ArrayList<>(); for (int row = 0; row < table.getRowCount();) { final List fora; final List forb; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java index 3e0f56f6b8..e675d05ad1 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java @@ -78,7 +78,7 @@ public class ConfigInfo extends JavaScriptObject { /*-{ return this.commentlinks; }-*/; final List commentlinks() { JsArray cls = commentlinks0().values(); - List commentLinks = new ArrayList(cls.length()); + List commentLinks = new ArrayList<>(cls.length()); for (int i = 0; i < cls.length(); i++) { CommentLinkInfo cl = cls.get(i); if (!cl.enabled()) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/CallbackGroup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/CallbackGroup.java index 51a899d1a0..7eaada02d3 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/CallbackGroup.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/CallbackGroup.java @@ -62,8 +62,8 @@ public class CallbackGroup { } public CallbackGroup() { - callbacks = new ArrayList>(); - remaining = new HashSet>(); + callbacks = new ArrayList<>(); + remaining = new HashSet<>(); } public Callback add(final AsyncCallback cb) { @@ -109,7 +109,7 @@ public class CallbackGroup { return emptyCallback(); } - CallbackImpl wrapper = new CallbackImpl(cb); + CallbackImpl wrapper = new CallbackImpl<>(cb); callbacks.add(wrapper); remaining.add(wrapper); return wrapper; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountGroupSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountGroupSuggestOracle.java index 278e159fbc..604699512a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountGroupSuggestOracle.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountGroupSuggestOracle.java @@ -28,8 +28,7 @@ import java.util.Map; /** Suggestion Oracle for AccountGroup entities. */ public class AccountGroupSuggestOracle extends SuggestAfterTypingNCharsOracle { - private Map priorResults = - new HashMap(); + private Map priorResults = new HashMap<>(); private Project.NameKey projectName; @@ -43,7 +42,7 @@ public class AccountGroupSuggestOracle extends SuggestAfterTypingNCharsOracle { public void onSuccess(final List result) { priorResults.clear(); final ArrayList r = - new ArrayList(result.size()); + new ArrayList<>(result.size()); for (final GroupReference p : result) { r.add(new AccountGroupSuggestion(p)); priorResults.put(p.getName(), p.getUUID()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountSuggestOracle.java index 0bf0ea9df3..4ffcd1878d 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountSuggestOracle.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountSuggestOracle.java @@ -34,7 +34,7 @@ public class AccountSuggestOracle extends SuggestAfterTypingNCharsOracle { new GerritCallback>() { public void onSuccess(final List result) { final ArrayList r = - new ArrayList(result.size()); + new ArrayList<>(result.size()); for (final AccountInfo p : result) { r.add(new AccountSuggestion(p)); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentLinkProcessor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentLinkProcessor.java index 10cd1f0fa5..fd7d40cf39 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentLinkProcessor.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentLinkProcessor.java @@ -38,9 +38,9 @@ public class CommentLinkProcessor { // One or more of the patterns isn't valid on this browser. // Try to filter the list down and remove the invalid ones. - List safe = new ArrayList(commentLinks.size()); + List safe = new ArrayList<>(commentLinks.size()); - List bad = new ArrayList(); + List bad = new ArrayList<>(); for (FindReplace r : commentLinks) { try { buf.replaceAll(Collections.singletonList(r)); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MorphingTabPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MorphingTabPanel.java index f68480e40b..db7ad3c899 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MorphingTabPanel.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MorphingTabPanel.java @@ -29,11 +29,11 @@ import java.util.List; */ public class MorphingTabPanel extends TabPanel { // Keep track of the order the widgets/texts should be in when not hidden. - private List widgets = new ArrayList(); - private List texts = new ArrayList(); + private List widgets = new ArrayList<>(); + private List texts = new ArrayList<>(); // currently visible widgets - private List visibles = new ArrayList(); + private List visibles = new ArrayList<>(); private int selection; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/OnEditEnabler.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/OnEditEnabler.java index 808252791d..a2155d4ef4 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/OnEditEnabler.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/OnEditEnabler.java @@ -46,7 +46,7 @@ public class OnEditEnabler implements KeyPressHandler, KeyDownHandler, MouseUpHandler, ChangeHandler, ValueChangeHandler { private final FocusWidget widget; - private Map strings = new HashMap(); + private Map strings = new HashMap<>(); private String originalValue; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ParentProjectBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ParentProjectBox.java index a03cb341df..4bf8fefab2 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ParentProjectBox.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ParentProjectBox.java @@ -60,7 +60,7 @@ public class ParentProjectBox extends Composite { } private static class ParentProjectNameSuggestOracle extends ProjectNameSuggestOracle { - private Set exclude = new HashSet(); + private Set exclude = new HashSet<>(); public void setProject(Project.NameKey project) { exclude.clear(); @@ -85,7 +85,7 @@ public class ParentProjectBox extends Composite { public void onSuggestionsReady(Request request, Response response) { if (exclude.size() > 0) { Set filteredSuggestions = - new HashSet(response.getSuggestions()); + new HashSet<>(response.getSuggestions()); for (Suggestion s : response.getSuggestions()) { if (exclude.contains(s.getReplacementString())) { filteredSuggestions.remove(s); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ReviewerSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ReviewerSuggestOracle.java index 3f1de2b699..12506daefc 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ReviewerSuggestOracle.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ReviewerSuggestOracle.java @@ -39,8 +39,7 @@ public class ReviewerSuggestOracle extends SuggestAfterTypingNCharsOracle { req.getLimit(), new GerritCallback>() { public void onSuccess(final List result) { final List r = - new ArrayList(result - .size()); + new ArrayList<>(result.size()); for (final ReviewerInfo reviewer : result) { r.add(new ReviewerSuggestion(reviewer)); } diff --git a/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java b/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java index cc13fcd2b6..02faccbb50 100644 --- a/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java +++ b/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java @@ -58,9 +58,9 @@ public class ModeInjector { Modes.I.xml(), }; - mimeAlias = new HashMap(); - mimeModes = new HashMap(); - modeUris = new HashMap(); + mimeAlias = new HashMap<>(); + mimeModes = new HashMap<>(); + modeUris = new HashMap<>(); for (DataResource m : all) { modeUris.put(m.getName(), m.getSafeUri()); @@ -103,7 +103,7 @@ public class ModeInjector { private static native JsArrayString getDependencies(String n) /*-{ return $wnd.CodeMirror.modes[n].dependencies || []; }-*/; - private final Set loading = new HashSet(4); + private final Set loading = new HashSet<>(4); private int pending; private AsyncCallback appCallback; diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/EditDeserializer.java b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/EditDeserializer.java index 9a55e0fd7d..5a9b9359a8 100644 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/EditDeserializer.java +++ b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/EditDeserializer.java @@ -49,7 +49,7 @@ public class EditDeserializer implements JsonDeserializer, return new Edit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); } - List l = new ArrayList((cnt / 4) - 1); + List l = new ArrayList<>((cnt / 4) - 1); for (int i = 4; i < cnt;) { int as = get(o, i++); int ae = get(o, i++); diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/Edit_JsonSerializer.java b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/Edit_JsonSerializer.java index 7870002389..1a3714b4cb 100644 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/Edit_JsonSerializer.java +++ b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/Edit_JsonSerializer.java @@ -35,7 +35,7 @@ public class Edit_JsonSerializer extends JsonSerializer { return new Edit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); } - List l = new ArrayList((cnt / 4) - 1); + List l = new ArrayList<>((cnt / 4) - 1); for (int i = 4; i < cnt;) { int as = get(o, i++); int ae = get(o, i++);