Use <> operator where possible

Change-Id: I88c51f471f0d901bfd8df4346d653fda62f07a0c
This commit is contained in:
Dave Borowitz
2019-01-02 11:13:02 -08:00
parent 4e4cdfe2ea
commit 7888debe88
15 changed files with 16 additions and 18 deletions

View File

@@ -417,7 +417,7 @@ public abstract class AbstractDaemonTest {
server.getTestInjector().injectMembers(this);
Transport.register(inProcessProtocol);
toClose = Collections.synchronizedList(new ArrayList<Repository>());
toClose = Collections.synchronizedList(new ArrayList<>());
// All groups which were added during the server start (e.g. in SchemaCreatorImpl) aren't
// contained in the instance of the group index which is available here and in tests. There are

View File

@@ -130,7 +130,7 @@ public class PublicKeyChecker {
if (store == null) {
throw new IllegalStateException("PublicKeyStore is required");
}
return check(key, 0, true, trusted != null ? new HashSet<Fingerprint>() : null);
return check(key, 0, true, trusted != null ? new HashSet<>() : null);
}
/**

View File

@@ -101,7 +101,7 @@ public abstract class QueryBuilder<T> {
&& (method.getModifiers() & Modifier.PUBLIC) == Modifier.PUBLIC) {
final String name = method.getName().toLowerCase();
if (!opFactories.containsKey(name)) {
opFactories.put(name, new ReflectionFactory<T, Q>(name, method));
opFactories.put(name, new ReflectionFactory<>(name, method));
}
}
}

View File

@@ -81,7 +81,7 @@ public class LuceneVersionManager extends VersionManager {
continue;
}
if (!versions.containsKey(v)) {
versions.put(v, new Version<V>(null, v, true, cfg.getReady(def.getName(), v)));
versions.put(v, new Version<>(null, v, true, cfg.getReady(def.getName(), v)));
}
}
} catch (IOException e) {

View File

@@ -78,7 +78,7 @@ public class Passwd extends SiteProgram {
bind(Boolean.class).annotatedWith(InstallAllPlugins.class).toInstance(Boolean.FALSE);
bind(new TypeLiteral<List<String>>() {})
.annotatedWith(InstallPlugins.class)
.toInstance(new ArrayList<String>());
.toInstance(new ArrayList<>());
bind(String.class)
.annotatedWith(SecureStoreClassName.class)
.toProvider(Providers.of(getConfiguredSecureStoreClass()));

View File

@@ -345,7 +345,7 @@ public class JettyServer {
maxThreads,
minThreads,
idleTimeout,
new BlockingArrayQueue<Runnable>(
new BlockingArrayQueue<>(
minThreads, // capacity,
minThreads, // growBy,
maxCapacity // maxCapacity

View File

@@ -239,8 +239,7 @@ public class BaseInit extends SiteProgram {
protected void configure() {
bind(ConsoleUI.class).toInstance(ui);
bind(Path.class).annotatedWith(SitePath.class).toInstance(sitePath);
List<String> plugins =
MoreObjects.firstNonNull(getInstallPlugins(), new ArrayList<String>());
List<String> plugins = MoreObjects.firstNonNull(getInstallPlugins(), new ArrayList<>());
bind(new TypeLiteral<List<String>>() {})
.annotatedWith(InstallPlugins.class)
.toInstance(plugins);

View File

@@ -171,8 +171,7 @@ public class DynamicOptions {
* classloaders.
*/
protected static Map<ClassLoader, Map<ClassLoader, WeakReference<ClassLoader>>> mergedClByCls =
Collections.synchronizedMap(
new WeakHashMap<ClassLoader, Map<ClassLoader, WeakReference<ClassLoader>>>());
Collections.synchronizedMap(new WeakHashMap<>());
protected Object bean;
protected Map<String, DynamicBean> beansByPlugin;

View File

@@ -67,7 +67,7 @@ public class GroupMembers {
throw new IllegalStateException("listAccounts called with PROJECT_OWNERS argument");
}
try {
return listAccounts(groupUUID, null, new HashSet<AccountGroup.UUID>());
return listAccounts(groupUUID, null, new HashSet<>());
} catch (NoSuchProjectException e) {
throw new IllegalStateException(e);
}
@@ -81,7 +81,7 @@ public class GroupMembers {
*/
public Set<Account> listAccounts(AccountGroup.UUID groupUUID, Project.NameKey project)
throws NoSuchProjectException, IOException {
return listAccounts(groupUUID, project, new HashSet<AccountGroup.UUID>());
return listAccounts(groupUUID, project, new HashSet<>());
}
private Set<Account> listAccounts(

View File

@@ -90,7 +90,7 @@ public class SysExecutorModule extends AbstractModule {
poolSize,
10,
TimeUnit.MINUTES,
new ArrayBlockingQueue<Runnable>(poolSize),
new ArrayBlockingQueue<>(poolSize),
new ThreadFactoryBuilder()
.setNameFormat("ChangeUpdate-%d")
.setDaemon(true)

View File

@@ -56,7 +56,7 @@ public class MarkdownFormatterHeader {
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
return new HashSet<NodeRenderingHandler<? extends Node>>(
return new HashSet<>(
Arrays.asList(
new NodeRenderingHandler<>(
AnchorLink.class,

View File

@@ -47,7 +47,7 @@ public class PluginMetricMaker extends MetricMaker implements LifecycleListener
public PluginMetricMaker(MetricMaker root, String prefix) {
this.root = root;
this.prefix = prefix.endsWith("/") ? prefix : prefix + "/";
cleanup = Collections.synchronizedSet(new HashSet<RegistrationHandle>());
cleanup = Collections.synchronizedSet(new HashSet<>());
}
@Override

View File

@@ -360,7 +360,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
String name = section.getName();
if (sectionsWithUnknownPermissions.contains(name)) {
AccessSection a = accessSections.get(name);
a.setPermissions(new ArrayList<Permission>());
a.setPermissions(new ArrayList<>());
} else {
accessSections.remove(name);
}

View File

@@ -87,7 +87,7 @@ public class FakeEmailSender implements EmailSender {
@Inject
FakeEmailSender(WorkQueue workQueue) {
this.workQueue = workQueue;
messages = Collections.synchronizedList(new ArrayList<Message>());
messages = Collections.synchronizedList(new ArrayList<>());
messagesRead = 0;
}

View File

@@ -351,7 +351,7 @@ public class SubmitResolvingMergeCommitIT extends AbstractDaemonTest {
private PushOneCommit.Result createChange(TestRepository<?> repo, String subject)
throws Exception {
return createChange(repo, subject, "x", "x", new ArrayList<RevCommit>(), "refs/for/master");
return createChange(repo, subject, "x", "x", new ArrayList<>(), "refs/for/master");
}
private PushOneCommit.Result createChange(