Apply "type inference for generic instance creation" Java 7 feature

Change-Id: Ia14802c903ca67b9d94dc6038d70b0e9644bc621
This commit is contained in:
David Ostrovsky
2014-04-26 15:27:57 +02:00
parent 40a179b8ca
commit e73ae61339
224 changed files with 557 additions and 633 deletions

View File

@@ -130,8 +130,7 @@ public class AcceptanceTestRequestScope {
} }
} }
private static final ThreadLocal<Context> current = private static final ThreadLocal<Context> current = new ThreadLocal<>();
new ThreadLocal<Context>();
private static Context requireContext() { private static Context requireContext() {
final Context ctx = current.get(); final Context ctx = current.get();

View File

@@ -212,6 +212,6 @@ class H2CacheFactory implements PersistentCacheFactory, LifecycleListener {
long maxSize) { long maxSize) {
File db = new File(cacheDir, name).getAbsoluteFile(); File db = new File(cacheDir, name).getAbsoluteFile();
String url = "jdbc:h2:" + db.toURI().toString(); String url = "jdbc:h2:" + db.toURI().toString();
return new SqlStore<K, V>(url, keyType, maxSize); return new SqlStore<>(url, keyType, maxSize);
} }
} }

View File

@@ -115,7 +115,7 @@ public class H2CacheImpl<K, V> extends AbstractLoadingCache<K, V> {
@Override @Override
public void put(final K key, V val) { public void put(final K key, V val) {
final ValueHolder<V> h = new ValueHolder<V>(val); final ValueHolder<V> h = new ValueHolder<>(val);
h.created = TimeUtil.nowMs(); h.created = TimeUtil.nowMs();
mem.put(key, h); mem.put(key, h);
executor.execute(new Runnable() { executor.execute(new Runnable() {
@@ -246,7 +246,7 @@ public class H2CacheImpl<K, V> extends AbstractLoadingCache<K, V> {
} }
} }
final ValueHolder<V> h = new ValueHolder<V>(loader.load(key)); final ValueHolder<V> h = new ValueHolder<>(loader.load(key));
h.created = TimeUtil.nowMs(); h.created = TimeUtil.nowMs();
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override @Override
@@ -302,7 +302,7 @@ public class H2CacheImpl<K, V> extends AbstractLoadingCache<K, V> {
return (KeyType<K>) OTHER; return (KeyType<K>) OTHER;
} }
static final KeyType<?> OTHER = new KeyType<Object>(); static final KeyType<?> OTHER = new KeyType<>();
static final KeyType<String> STRING = new KeyType<String>() { static final KeyType<String> STRING = new KeyType<String>() {
@Override @Override
String columnType() { String columnType() {
@@ -346,7 +346,7 @@ public class H2CacheImpl<K, V> extends AbstractLoadingCache<K, V> {
int cores = Runtime.getRuntime().availableProcessors(); int cores = Runtime.getRuntime().availableProcessors();
int keep = Math.min(cores, 16); int keep = Math.min(cores, 16);
this.handles = new ArrayBlockingQueue<SqlHandle>(keep); this.handles = new ArrayBlockingQueue<>(keep);
} }
synchronized void open() { synchronized void open() {
@@ -440,7 +440,7 @@ public class H2CacheImpl<K, V> extends AbstractLoadingCache<K, V> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
V val = (V) r.getObject(1); V val = (V) r.getObject(1);
ValueHolder<V> h = new ValueHolder<V>(val); ValueHolder<V> h = new ValueHolder<>(val);
h.clean = true; h.clean = true;
hitCount.incrementAndGet(); hitCount.incrementAndGet();
touch(c, key); touch(c, key);

View File

@@ -33,7 +33,7 @@ public class LabelTypes {
public LabelTypes(final List<? extends LabelType> approvals) { public LabelTypes(final List<? extends LabelType> approvals) {
labelTypes = labelTypes =
Collections.unmodifiableList(new ArrayList<LabelType>(approvals)); Collections.unmodifiableList(new ArrayList<>(approvals));
} }
public List<LabelType> getLabelTypes() { public List<LabelType> getLabelTypes() {

View File

@@ -48,7 +48,7 @@ public class Permission implements Comparable<Permission> {
private static final int labelAsIndex; private static final int labelAsIndex;
static { static {
NAMES_LC = new ArrayList<String>(); NAMES_LC = new ArrayList<>();
NAMES_LC.add(OWNER.toLowerCase()); NAMES_LC.add(OWNER.toLowerCase());
NAMES_LC.add(READ.toLowerCase()); NAMES_LC.add(READ.toLowerCase());
NAMES_LC.add(ABANDON.toLowerCase()); NAMES_LC.add(ABANDON.toLowerCase());
@@ -229,7 +229,7 @@ public class Permission implements Comparable<Permission> {
private void initRules() { private void initRules() {
if (rules == null) { if (rules == null) {
rules = new ArrayList<PermissionRule>(4); rules = new ArrayList<>(4);
} }
} }

View File

@@ -97,7 +97,7 @@ public class ReviewInput {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
if (labels == null) { if (labels == null) {
labels = new LinkedHashMap<String, Short>(4); labels = new LinkedHashMap<>(4);
} }
labels.put(name, value); labels.put(name, value);
return this; return this;

View File

@@ -78,7 +78,7 @@ public class DynamicItem<T> {
Key<DynamicItem<T>> key = (Key<DynamicItem<T>>) Key.get( Key<DynamicItem<T>> key = (Key<DynamicItem<T>>) Key.get(
Types.newParameterizedType(DynamicItem.class, member.getType())); Types.newParameterizedType(DynamicItem.class, member.getType()));
binder.bind(key) binder.bind(key)
.toProvider(new DynamicItemProvider<T>(member, key)) .toProvider(new DynamicItemProvider<>(member, key))
.in(Scopes.SINGLETON); .in(Scopes.SINGLETON);
} }
@@ -111,10 +111,10 @@ public class DynamicItem<T> {
DynamicItem(Key<DynamicItem<T>> key, Provider<T> provider, String pluginName) { DynamicItem(Key<DynamicItem<T>> key, Provider<T> provider, String pluginName) {
NamedProvider<T> in = null; NamedProvider<T> in = null;
if (provider != null) { if (provider != null) {
in = new NamedProvider<T>(provider, pluginName); in = new NamedProvider<>(provider, pluginName);
} }
this.key = key; this.key = key;
this.ref = new AtomicReference<NamedProvider<T>>(in); this.ref = new AtomicReference<>(in);
} }
/** /**
@@ -148,7 +148,7 @@ public class DynamicItem<T> {
* @return handle to remove the item at a later point in time. * @return handle to remove the item at a later point in time.
*/ */
public RegistrationHandle set(Provider<T> impl, String pluginName) { public RegistrationHandle set(Provider<T> impl, String pluginName) {
final NamedProvider<T> item = new NamedProvider<T>(impl, pluginName); final NamedProvider<T> item = new NamedProvider<>(impl, pluginName);
NamedProvider<T> old = null; NamedProvider<T> old = null;
while (!ref.compareAndSet(old, item)) { while (!ref.compareAndSet(old, item)) {
old = ref.get(); old = ref.get();
@@ -180,7 +180,7 @@ public class DynamicItem<T> {
*/ */
public ReloadableRegistrationHandle<T> set(Key<T> key, Provider<T> impl, public ReloadableRegistrationHandle<T> set(Key<T> key, Provider<T> impl,
String pluginName) { String pluginName) {
final NamedProvider<T> item = new NamedProvider<T>(impl, pluginName); final NamedProvider<T> item = new NamedProvider<>(impl, pluginName);
NamedProvider<T> old = null; NamedProvider<T> old = null;
while (!ref.compareAndSet(old, item)) { while (!ref.compareAndSet(old, item)) {
old = ref.get(); old = ref.get();
@@ -216,7 +216,7 @@ public class DynamicItem<T> {
@Override @Override
public ReloadableHandle replace(Key<T> newKey, Provider<T> newItem) { public ReloadableHandle replace(Key<T> newKey, Provider<T> newItem) {
NamedProvider<T> n = new NamedProvider<T>(newItem, item.pluginName); NamedProvider<T> n = new NamedProvider<>(newItem, item.pluginName);
if (ref.compareAndSet(item, n)) { if (ref.compareAndSet(item, n)) {
return new ReloadableHandle(newKey, n, defaultItem); return new ReloadableHandle(newKey, n, defaultItem);
} }

View File

@@ -37,7 +37,7 @@ class DynamicItemProvider<T> implements Provider<DynamicItem<T>> {
} }
public DynamicItem<T> get() { public DynamicItem<T> get() {
return new DynamicItem<T>(key, find(injector, type), "gerrit"); return new DynamicItem<>(key, find(injector, type), "gerrit");
} }
private static <T> Provider<T> find(Injector src, TypeLiteral<T> type) { private static <T> Provider<T> find(Injector src, TypeLiteral<T> type) {

View File

@@ -81,14 +81,14 @@ public abstract class DynamicMap<T> implements Iterable<DynamicMap.Entry<T>> {
Key<DynamicMap<T>> key = (Key<DynamicMap<T>>) Key.get( Key<DynamicMap<T>> key = (Key<DynamicMap<T>>) Key.get(
Types.newParameterizedType(DynamicMap.class, member.getType())); Types.newParameterizedType(DynamicMap.class, member.getType()));
binder.bind(key) binder.bind(key)
.toProvider(new DynamicMapProvider<T>(member)) .toProvider(new DynamicMapProvider<>(member))
.in(Scopes.SINGLETON); .in(Scopes.SINGLETON);
} }
final ConcurrentMap<NamePair, Provider<T>> items; final ConcurrentMap<NamePair, Provider<T>> items;
DynamicMap() { DynamicMap() {
items = new ConcurrentHashMap<NamePair, Provider<T>>( items = new ConcurrentHashMap<>(
16 /* initial size */, 16 /* initial size */,
0.75f /* load factor */, 0.75f /* load factor */,
1 /* concurrency level of 1, load/unload is single threaded */); 1 /* concurrency level of 1, load/unload is single threaded */);
@@ -115,7 +115,7 @@ public abstract class DynamicMap<T> implements Iterable<DynamicMap.Entry<T>> {
* @return sorted set of active plugins that supply at least one item. * @return sorted set of active plugins that supply at least one item.
*/ */
public SortedSet<String> plugins() { public SortedSet<String> plugins() {
SortedSet<String> r = new TreeSet<String>(); SortedSet<String> r = new TreeSet<>();
for (NamePair p : items.keySet()) { for (NamePair p : items.keySet()) {
r.add(p.pluginName); r.add(p.pluginName);
} }
@@ -129,7 +129,7 @@ public abstract class DynamicMap<T> implements Iterable<DynamicMap.Entry<T>> {
* @return items exported by a plugin, keyed by the export name. * @return items exported by a plugin, keyed by the export name.
*/ */
public SortedMap<String, Provider<T>> byPlugin(String pluginName) { public SortedMap<String, Provider<T>> byPlugin(String pluginName) {
SortedMap<String, Provider<T>> r = new TreeMap<String, Provider<T>>(); SortedMap<String, Provider<T>> r = new TreeMap<>();
for (Map.Entry<NamePair, Provider<T>> e : items.entrySet()) { for (Map.Entry<NamePair, Provider<T>> e : items.entrySet()) {
if (e.getKey().pluginName.equals(pluginName)) { if (e.getKey().pluginName.equals(pluginName)) {
r.put(e.getKey().exportName, e.getValue()); r.put(e.getKey().exportName, e.getValue());

View File

@@ -34,7 +34,7 @@ class DynamicMapProvider<T> implements Provider<DynamicMap<T>> {
public DynamicMap<T> get() { public DynamicMap<T> get() {
PrivateInternals_DynamicMapImpl<T> m = PrivateInternals_DynamicMapImpl<T> m =
new PrivateInternals_DynamicMapImpl<T>(); new PrivateInternals_DynamicMapImpl<>();
List<Binding<T>> bindings = injector.findBindingsByType(type); List<Binding<T>> bindings = injector.findBindingsByType(type);
if (bindings != null) { if (bindings != null) {
for (Binding<T> b : bindings) { for (Binding<T> b : bindings) {

View File

@@ -72,7 +72,7 @@ public class DynamicSet<T> implements Iterable<T> {
Key<DynamicSet<T>> key = (Key<DynamicSet<T>>) Key.get( Key<DynamicSet<T>> key = (Key<DynamicSet<T>>) Key.get(
Types.newParameterizedType(DynamicSet.class, member.getType())); Types.newParameterizedType(DynamicSet.class, member.getType()));
binder.bind(key) binder.bind(key)
.toProvider(new DynamicSetProvider<T>(member)) .toProvider(new DynamicSetProvider<>(member))
.in(Scopes.SINGLETON); .in(Scopes.SINGLETON);
} }
@@ -136,7 +136,7 @@ public class DynamicSet<T> implements Iterable<T> {
private final CopyOnWriteArrayList<AtomicReference<Provider<T>>> items; private final CopyOnWriteArrayList<AtomicReference<Provider<T>>> items;
DynamicSet(Collection<AtomicReference<Provider<T>>> base) { DynamicSet(Collection<AtomicReference<Provider<T>>> base) {
items = new CopyOnWriteArrayList<AtomicReference<Provider<T>>>(base); items = new CopyOnWriteArrayList<>(base);
} }
@Override @Override
@@ -194,8 +194,7 @@ public class DynamicSet<T> implements Iterable<T> {
* @return handle to remove the item at a later point in time. * @return handle to remove the item at a later point in time.
*/ */
public RegistrationHandle add(final Provider<T> item) { public RegistrationHandle add(final Provider<T> item) {
final AtomicReference<Provider<T>> ref = final AtomicReference<Provider<T>> ref = new AtomicReference<>(item);
new AtomicReference<Provider<T>>(item);
items.add(ref); items.add(ref);
return new RegistrationHandle() { return new RegistrationHandle() {
@Override @Override
@@ -218,7 +217,7 @@ public class DynamicSet<T> implements Iterable<T> {
* without it ever leaving the collection. * without it ever leaving the collection.
*/ */
public ReloadableRegistrationHandle<T> add(Key<T> key, Provider<T> item) { public ReloadableRegistrationHandle<T> add(Key<T> key, Provider<T> item) {
AtomicReference<Provider<T>> ref = new AtomicReference<Provider<T>>(item); AtomicReference<Provider<T>> ref = new AtomicReference<>(item);
items.add(ref); items.add(ref);
return new ReloadableHandle(ref, key, item); return new ReloadableHandle(ref, key, item);
} }

View File

@@ -36,7 +36,7 @@ class DynamicSetProvider<T> implements Provider<DynamicSet<T>> {
} }
public DynamicSet<T> get() { public DynamicSet<T> get() {
return new DynamicSet<T>(find(injector, type)); return new DynamicSet<>(find(injector, type));
} }
private static <T> List<AtomicReference<Provider<T>>> find( private static <T> List<AtomicReference<Provider<T>>> find(
@@ -47,16 +47,12 @@ class DynamicSetProvider<T> implements Provider<DynamicSet<T>> {
if (cnt == 0) { if (cnt == 0) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<AtomicReference<Provider<T>>> r = newList(cnt); List<AtomicReference<Provider<T>>> r = new ArrayList<>(cnt);
for (Binding<T> b : bindings) { for (Binding<T> b : bindings) {
if (b.getKey().getAnnotation() != null) { if (b.getKey().getAnnotation() != null) {
r.add(new AtomicReference<Provider<T>>(b.getProvider())); r.add(new AtomicReference<>(b.getProvider()));
} }
} }
return r; return r;
} }
private static <T> List<AtomicReference<Provider<T>>> newList(int cnt) {
return new ArrayList<AtomicReference<Provider<T>>>(cnt);
}
} }

View File

@@ -31,7 +31,7 @@ import java.util.Map;
/** <b>DO NOT USE</b> */ /** <b>DO NOT USE</b> */
public class PrivateInternals_DynamicTypes { public class PrivateInternals_DynamicTypes {
public static Map<TypeLiteral<?>, DynamicItem<?>> dynamicItemsOf(Injector src) { public static Map<TypeLiteral<?>, DynamicItem<?>> dynamicItemsOf(Injector src) {
Map<TypeLiteral<?>, DynamicItem<?>> m = newHashMap(); Map<TypeLiteral<?>, DynamicItem<?>> m = new HashMap<>();
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) { for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
TypeLiteral<?> type = e.getKey().getTypeLiteral(); TypeLiteral<?> type = e.getKey().getTypeLiteral();
if (type.getRawType() == DynamicItem.class) { if (type.getRawType() == DynamicItem.class) {
@@ -47,7 +47,7 @@ public class PrivateInternals_DynamicTypes {
} }
public static Map<TypeLiteral<?>, DynamicSet<?>> dynamicSetsOf(Injector src) { public static Map<TypeLiteral<?>, DynamicSet<?>> dynamicSetsOf(Injector src) {
Map<TypeLiteral<?>, DynamicSet<?>> m = newHashMap(); Map<TypeLiteral<?>, DynamicSet<?>> m = new HashMap<>();
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) { for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
TypeLiteral<?> type = e.getKey().getTypeLiteral(); TypeLiteral<?> type = e.getKey().getTypeLiteral();
if (type.getRawType() == DynamicSet.class) { if (type.getRawType() == DynamicSet.class) {
@@ -63,7 +63,7 @@ public class PrivateInternals_DynamicTypes {
} }
public static Map<TypeLiteral<?>, DynamicMap<?>> dynamicMapsOf(Injector src) { public static Map<TypeLiteral<?>, DynamicMap<?>> dynamicMapsOf(Injector src) {
Map<TypeLiteral<?>, DynamicMap<?>> m = newHashMap(); Map<TypeLiteral<?>, DynamicMap<?>> m = new HashMap<>();
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) { for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
TypeLiteral<?> type = e.getKey().getTypeLiteral(); TypeLiteral<?> type = e.getKey().getTypeLiteral();
if (type.getRawType() == DynamicMap.class) { if (type.getRawType() == DynamicMap.class) {
@@ -85,7 +85,7 @@ public class PrivateInternals_DynamicTypes {
return Collections.emptyList(); return Collections.emptyList();
} }
List<RegistrationHandle> handles = new ArrayList<RegistrationHandle>(4); List<RegistrationHandle> handles = new ArrayList<>(4);
try { try {
for (Map.Entry<TypeLiteral<?>, DynamicItem<?>> e : items.entrySet()) { for (Map.Entry<TypeLiteral<?>, DynamicItem<?>> e : items.entrySet()) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -115,7 +115,7 @@ public class PrivateInternals_DynamicTypes {
return Collections.emptyList(); return Collections.emptyList();
} }
List<RegistrationHandle> handles = new ArrayList<RegistrationHandle>(4); List<RegistrationHandle> handles = new ArrayList<>(4);
try { try {
for (Map.Entry<TypeLiteral<?>, DynamicSet<?>> e : sets.entrySet()) { for (Map.Entry<TypeLiteral<?>, DynamicSet<?>> e : sets.entrySet()) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -148,7 +148,7 @@ public class PrivateInternals_DynamicTypes {
return Collections.emptyList(); return Collections.emptyList();
} }
List<RegistrationHandle> handles = new ArrayList<RegistrationHandle>(4); List<RegistrationHandle> handles = new ArrayList<>(4);
try { try {
for (Map.Entry<TypeLiteral<?>, DynamicMap<?>> e : maps.entrySet()) { for (Map.Entry<TypeLiteral<?>, DynamicMap<?>> e : maps.entrySet()) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -183,7 +183,7 @@ public class PrivateInternals_DynamicTypes {
@Override @Override
public void start() { public void start() {
handles = new ArrayList<RegistrationHandle>(4); handles = new ArrayList<>(4);
Injector parent = self.getParent(); Injector parent = self.getParent();
while (parent != null) { while (parent != null) {
handles.addAll(attachSets(self, dynamicSetsOf(parent))); handles.addAll(attachSets(self, dynamicSetsOf(parent)));
@@ -211,10 +211,6 @@ public class PrivateInternals_DynamicTypes {
} }
} }
private static <K,V> Map<K, V> newHashMap() {
return new HashMap<K,V>();
}
private static <T> List<Binding<T>> bindings(Injector src, TypeLiteral<T> type) { private static <T> List<Binding<T>> bindings(Injector src, TypeLiteral<T> type) {
return src.findBindingsByType(type); return src.findBindingsByType(type);
} }

View File

@@ -21,12 +21,12 @@ public abstract class Response<T> {
/** HTTP 200 OK: pointless wrapper for type safety. */ /** HTTP 200 OK: pointless wrapper for type safety. */
public static <T> Response<T> ok(T value) { public static <T> Response<T> ok(T value) {
return new Impl<T>(200, value); return new Impl<>(200, value);
} }
/** HTTP 201 Created: typically used when a new resource is made. */ /** HTTP 201 Created: typically used when a new resource is made. */
public static <T> Response<T> created(T value) { public static <T> Response<T> created(T value) {
return new Impl<T>(201, value); return new Impl<>(201, value);
} }
/** HTTP 204 No Content: typically used when the resource is deleted. */ /** HTTP 204 No Content: typically used when the resource is deleted. */

View File

@@ -31,47 +31,47 @@ public abstract class RestApiModule extends AbstractModule {
protected <R extends RestResource> protected <R extends RestResource>
ReadViewBinder<R> get(TypeLiteral<RestView<R>> viewType) { ReadViewBinder<R> get(TypeLiteral<RestView<R>> viewType) {
return new ReadViewBinder<R>(view(viewType, GET, "/")); return new ReadViewBinder<>(view(viewType, GET, "/"));
} }
protected <R extends RestResource> protected <R extends RestResource>
ModifyViewBinder<R> put(TypeLiteral<RestView<R>> viewType) { ModifyViewBinder<R> put(TypeLiteral<RestView<R>> viewType) {
return new ModifyViewBinder<R>(view(viewType, PUT, "/")); return new ModifyViewBinder<>(view(viewType, PUT, "/"));
} }
protected <R extends RestResource> protected <R extends RestResource>
ModifyViewBinder<R> post(TypeLiteral<RestView<R>> viewType) { ModifyViewBinder<R> post(TypeLiteral<RestView<R>> viewType) {
return new ModifyViewBinder<R>(view(viewType, POST, "/")); return new ModifyViewBinder<>(view(viewType, POST, "/"));
} }
protected <R extends RestResource> protected <R extends RestResource>
ModifyViewBinder<R> delete(TypeLiteral<RestView<R>> viewType) { ModifyViewBinder<R> delete(TypeLiteral<RestView<R>> viewType) {
return new ModifyViewBinder<R>(view(viewType, DELETE, "/")); return new ModifyViewBinder<>(view(viewType, DELETE, "/"));
} }
protected <R extends RestResource> protected <R extends RestResource>
ReadViewBinder<R> get(TypeLiteral<RestView<R>> viewType, String name) { ReadViewBinder<R> get(TypeLiteral<RestView<R>> viewType, String name) {
return new ReadViewBinder<R>(view(viewType, GET, name)); return new ReadViewBinder<>(view(viewType, GET, name));
} }
protected <R extends RestResource> protected <R extends RestResource>
ModifyViewBinder<R> put(TypeLiteral<RestView<R>> viewType, String name) { ModifyViewBinder<R> put(TypeLiteral<RestView<R>> viewType, String name) {
return new ModifyViewBinder<R>(view(viewType, PUT, name)); return new ModifyViewBinder<>(view(viewType, PUT, name));
} }
protected <R extends RestResource> protected <R extends RestResource>
ModifyViewBinder<R> post(TypeLiteral<RestView<R>> viewType, String name) { ModifyViewBinder<R> post(TypeLiteral<RestView<R>> viewType, String name) {
return new ModifyViewBinder<R>(view(viewType, POST, name)); return new ModifyViewBinder<>(view(viewType, POST, name));
} }
protected <R extends RestResource> protected <R extends RestResource>
ModifyViewBinder<R> delete(TypeLiteral<RestView<R>> viewType, String name) { ModifyViewBinder<R> delete(TypeLiteral<RestView<R>> viewType, String name) {
return new ModifyViewBinder<R>(view(viewType, DELETE, name)); return new ModifyViewBinder<>(view(viewType, DELETE, name));
} }
protected <P extends RestResource> protected <P extends RestResource>
ChildCollectionBinder<P> child(TypeLiteral<RestView<P>> type, String name) { ChildCollectionBinder<P> child(TypeLiteral<RestView<P>> type, String name) {
return new ChildCollectionBinder<P>(view(type, GET, name)); return new ChildCollectionBinder<>(view(type, GET, name));
} }
protected <R extends RestResource> protected <R extends RestResource>

View File

@@ -44,8 +44,7 @@ public class CssLinker extends AbstractLinker {
final ArtifactSet returnTo = new ArtifactSet(); final ArtifactSet returnTo = new ArtifactSet();
int index = 0; int index = 0;
final HashMap<String, PublicResource> css = final HashMap<String, PublicResource> css = new HashMap<>();
new HashMap<String, PublicResource>();
for (final StandardStylesheetReference ssr : artifacts for (final StandardStylesheetReference ssr : artifacts
.<StandardStylesheetReference> find(StandardStylesheetReference.class)) { .<StandardStylesheetReference> find(StandardStylesheetReference.class)) {

View File

@@ -35,7 +35,7 @@ public class KeyCommandSet implements KeyPressHandler {
} }
public KeyCommandSet(final String setName) { public KeyCommandSet(final String setName) {
map = new HashMap<Integer, KeyCommand>(); map = new HashMap<>();
name = setName; name = setName;
} }
@@ -79,7 +79,7 @@ public class KeyCommandSet implements KeyPressHandler {
public void add(final KeyCommandSet set) { public void add(final KeyCommandSet set) {
if (sets == null) { if (sets == null) {
sets = new ArrayList<KeyCommandSet>(); sets = new ArrayList<>();
} }
assert !sets.contains(set); assert !sets.contains(set);
sets.add(set); sets.add(set);

View File

@@ -133,8 +133,7 @@ public class KeyHelpPopup extends PluginSafePopupPanel implements
* the same name, so that each set name appears at most once. * the same name, so that each set name appears at most once.
*/ */
private static Collection<KeyCommandSet> combinedSetsByName() { private static Collection<KeyCommandSet> combinedSetsByName() {
final LinkedHashMap<String, KeyCommandSet> byName = LinkedHashMap<String, KeyCommandSet> byName = new LinkedHashMap<>();
new LinkedHashMap<String, KeyCommandSet>();
for (final KeyCommandSet set : GlobalKey.active.all.getSets()) { for (final KeyCommandSet set : GlobalKey.active.all.getSets()) {
KeyCommandSet v = byName.get(set.getName()); KeyCommandSet v = byName.get(set.getName());
if (v == null) { if (v == null) {
@@ -171,7 +170,7 @@ public class KeyHelpPopup extends PluginSafePopupPanel implements
lists.resizeRows(row + keys.size()); lists.resizeRows(row + keys.size());
} }
Map<KeyCommand, Integer> rows = new HashMap<KeyCommand, Integer>(); Map<KeyCommand, Integer> rows = new HashMap<>();
FORMAT_KEYS: for (int i = 0; i < keys.size(); i++) { FORMAT_KEYS: for (int i = 0; i < keys.size(); i++) {
final KeyCommand k = keys.get(i); final KeyCommand k = keys.get(i);
if (rows.containsKey(k)) { if (rows.containsKey(k)) {
@@ -234,7 +233,7 @@ public class KeyHelpPopup extends PluginSafePopupPanel implements
} }
private List<KeyCommand> sort(final KeyCommandSet set) { private List<KeyCommand> sort(final KeyCommandSet set) {
final List<KeyCommand> keys = new ArrayList<KeyCommand>(set.getKeys()); final List<KeyCommand> keys = new ArrayList<>(set.getKeys());
Collections.sort(keys, new Comparator<KeyCommand>() { Collections.sort(keys, new Comparator<KeyCommand>() {
@Override @Override
public int compare(KeyCommand arg0, KeyCommand arg1) { public int compare(KeyCommand arg0, KeyCommand arg1) {

View File

@@ -23,7 +23,7 @@ class AttMap {
private static final HashMap<String, Tag> TAGS; private static final HashMap<String, Tag> TAGS;
static { static {
final Tag src = new SrcTag(); final Tag src = new SrcTag();
TAGS = new HashMap<String, Tag>(); TAGS = new HashMap<>();
TAGS.put("a", new AnchorTag()); TAGS.put("a", new AnchorTag());
TAGS.put("form", new FormTag()); TAGS.put("form", new FormTag());
TAGS.put("img", src); TAGS.put("img", src);
@@ -31,8 +31,8 @@ class AttMap {
TAGS.put("frame", src); TAGS.put("frame", src);
} }
private final ArrayList<String> names = new ArrayList<String>(); private final ArrayList<String> names = new ArrayList<>();
private final ArrayList<String> values = new ArrayList<String>(); private final ArrayList<String> values = new ArrayList<>();
private Tag tag = ANY; private Tag tag = ANY;
private int live; private int live;

View File

@@ -45,7 +45,7 @@ public abstract class HighlightSuggestOracle extends SuggestOracle {
final Response response) { final Response response) {
final String qpat = getQueryPattern(request.getQuery()); final String qpat = getQueryPattern(request.getQuery());
final boolean html = isHTML(); final boolean html = isHTML();
final ArrayList<Suggestion> r = new ArrayList<Suggestion>(); final ArrayList<Suggestion> r = new ArrayList<>();
for (final Suggestion s : response.getSuggestions()) { for (final Suggestion s : response.getSuggestions()) {
r.add(new BoldSuggestion(qpat, s, html)); r.add(new BoldSuggestion(qpat, s, html));
} }

View File

@@ -22,7 +22,7 @@ public class DialogVisibleEvent extends GwtEvent<DialogVisibleHandler> {
public static Type<DialogVisibleHandler> getType() { public static Type<DialogVisibleHandler> getType() {
if (TYPE == null) { if (TYPE == null) {
TYPE = new Type<DialogVisibleHandler>(); TYPE = new Type<>();
} }
return TYPE; return TYPE;
} }

View File

@@ -74,7 +74,7 @@ class MessageOfTheDayBar extends Composite {
} }
private static List<HostPageData.Message> filter(List<HostPageData.Message> in) { private static List<HostPageData.Message> filter(List<HostPageData.Message> in) {
List<HostPageData.Message> show = new ArrayList<HostPageData.Message>(); List<HostPageData.Message> show = new ArrayList<>();
for (HostPageData.Message m : in) { for (HostPageData.Message m : in) {
if (Cookies.getCookie(cookieName(m)) == null) { if (Cookies.getCookie(cookieName(m)) == null) {
show.add(m); show.add(m);

View File

@@ -124,8 +124,8 @@ public class PermissionEditor extends Composite implements Editor<Permission>,
PermissionNameRenderer nameRenderer = PermissionNameRenderer nameRenderer =
new PermissionNameRenderer(projectAccess.getCapabilities()); new PermissionNameRenderer(projectAccess.getCapabilities());
normalName = new ValueLabel<String>(nameRenderer); normalName = new ValueLabel<>(nameRenderer);
deletedName = new ValueLabel<String>(nameRenderer); deletedName = new ValueLabel<>(nameRenderer);
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
groupToAdd.setProject(projectName); groupToAdd.setProject(projectName);

View File

@@ -101,7 +101,7 @@ public class PermissionRuleEditor extends Composite implements
Permission permission, Permission permission,
PermissionRange.WithDefaults validRange) { PermissionRange.WithDefaults validRange) {
this.groupInfo = groupInfo; this.groupInfo = groupInfo;
action = new ValueListBox<PermissionRule.Action>(actionRenderer); action = new ValueListBox<>(actionRenderer);
if (validRange != null && 10 < validRange.getRangeSize()) { if (validRange != null && 10 < validRange.getRangeSize()) {
min = new RangeBox.Box(); min = new RangeBox.Box();

View File

@@ -49,7 +49,7 @@ abstract class RangeBox extends Composite implements
final ValueListBox<Integer> list; final ValueListBox<Integer> list;
List() { List() {
list = new ValueListBox<Integer>(rangeRenderer); list = new ValueListBox<>(rangeRenderer);
initWidget(list); initWidget(list);
} }

View File

@@ -300,7 +300,7 @@ public class ChangeScreen extends Screen
CallbackGroup cbs1 = new CallbackGroup(); CallbackGroup cbs1 = new CallbackGroup();
final CallbackGroup cbs2 = new CallbackGroup(); final CallbackGroup cbs2 = new CallbackGroup();
final PatchSet.Id psId = event.getValue().getCurrentPatchSet().getId(); final PatchSet.Id psId = event.getValue().getCurrentPatchSet().getId();
final Map<String, Patch> patches = new HashMap<String, Patch>(); final Map<String, Patch> patches = new HashMap<>();
String revId = String revId =
event.getValue().getCurrentPatchSetDetail().getInfo().getRevId(); event.getValue().getCurrentPatchSetDetail().getInfo().getRevId();
@@ -330,7 +330,7 @@ public class ChangeScreen extends Screen
private void dependsOn(RelatedChanges.RelatedInfo info) { private void dependsOn(RelatedChanges.RelatedInfo info) {
ChangeAndCommit self = null; ChangeAndCommit self = null;
Map<String, ChangeAndCommit> m = new HashMap<String, ChangeAndCommit>(); Map<String, ChangeAndCommit> m = new HashMap<>();
for (int i = 0; i < info.changes().length(); i++) { for (int i = 0; i < info.changes().length(); i++) {
ChangeAndCommit c = info.changes().get(i); ChangeAndCommit c = info.changes().get(i);
if (changeId.equals(c.legacy_id())) { if (changeId.equals(c.legacy_id())) {
@@ -342,7 +342,7 @@ public class ChangeScreen extends Screen
} }
if (self != null && self.commit() != null if (self != null && self.commit() != null
&& self.commit().parents() != null) { && self.commit().parents() != null) {
List<ChangeInfo> d = new ArrayList<ChangeInfo>(); List<ChangeInfo> d = new ArrayList<>();
for (CommitInfo p : Natives.asList(self.commit().parents())) { for (CommitInfo p : Natives.asList(self.commit().parents())) {
ChangeAndCommit pc = m.get(p.commit()); ChangeAndCommit pc = m.get(p.commit());
if (pc != null && pc.has_change_number()) { if (pc != null && pc.has_change_number()) {
@@ -356,12 +356,12 @@ public class ChangeScreen extends Screen
} }
private void neededBy(RelatedChanges.RelatedInfo info) { private void neededBy(RelatedChanges.RelatedInfo info) {
Set<String> mine = new HashSet<String>(); Set<String> mine = new HashSet<>();
for (PatchSet ps : event.getValue().getPatchSets()) { for (PatchSet ps : event.getValue().getPatchSets()) {
mine.add(ps.getRevision().get()); mine.add(ps.getRevision().get());
} }
List<ChangeInfo> n = new ArrayList<ChangeInfo>(); List<ChangeInfo> n = new ArrayList<>();
for (int i = 0; i < info.changes().length(); i++) { for (int i = 0; i < info.changes().length(); i++) {
ChangeAndCommit c = info.changes().get(i); ChangeAndCommit c = info.changes().get(i);
if (c.has_change_number() if (c.has_change_number()
@@ -418,7 +418,7 @@ public class ChangeScreen extends Screen
} }
public void onFailure(Throwable caught) {} public void onFailure(Throwable caught) {}
})); }));
final Set<PatchSet.Id> withDrafts = new HashSet<PatchSet.Id>(); final Set<PatchSet.Id> withDrafts = new HashSet<>();
event.getValue().setPatchSetsWithDraftComments(withDrafts); event.getValue().setPatchSetsWithDraftComments(withDrafts);
for (PatchSet ps : event.getValue().getPatchSets()) { for (PatchSet ps : event.getValue().getPatchSets()) {
if (!ps.getId().equals(psId)) { if (!ps.getId().equals(psId)) {
@@ -478,7 +478,7 @@ public class ChangeScreen extends Screen
public void onSuccess(NativeMap<FileInfo> result) { public void onSuccess(NativeMap<FileInfo> result) {
JsArray<FileInfo> fileInfos = result.values(); JsArray<FileInfo> fileInfos = result.values();
FileInfo.sortFileInfoByPath(fileInfos); FileInfo.sortFileInfoByPath(fileInfos);
List<Patch> list = new ArrayList<Patch>(fileInfos.length()); List<Patch> list = new ArrayList<>(fileInfos.length());
for (FileInfo f : Natives.asList(fileInfos)) { for (FileInfo f : Natives.asList(fileInfos)) {
Patch p = patches.get(f.path()); Patch p = patches.get(f.path());
if (p == null) { if (p == null) {

View File

@@ -59,7 +59,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar())); keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar()));
} }
sections = new ArrayList<Section>(); sections = new ArrayList<>();
table.setText(0, C_STAR, ""); table.setText(0, C_STAR, "");
table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject()); table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject());
table.setText(0, C_OWNER, Util.C.changeTableColumnOwner()); table.setText(0, C_OWNER, Util.C.changeTableColumnOwner());
@@ -308,7 +308,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
parent.insertNoneRow(dataBegin); parent.insertNoneRow(dataBegin);
} }
} else { } else {
Set<Change.Id> cids = new HashSet<Change.Id>(); Set<Change.Id> cids = new HashSet<>();
if (!hadData) { if (!hadData) {
parent.removeRow(dataBegin); parent.removeRow(dataBegin);

View File

@@ -76,7 +76,7 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
private Grid infoTable; private Grid infoTable;
private Panel actionsPanel; private Panel actionsPanel;
private PatchTable patchTable; private PatchTable patchTable;
private final Set<ClickHandler> registeredClickHandler = new HashSet<ClickHandler>(); private final Set<ClickHandler> registeredClickHandler = new HashSet<>();
private PatchSet.Id diffBaseId; private PatchSet.Id diffBaseId;

View File

@@ -44,7 +44,7 @@ import java.util.Map;
*/ */
public class PatchSetsBlock extends Composite { public class PatchSetsBlock extends Composite {
private final Map<PatchSet.Id, PatchSetComplexDisclosurePanel> patchSetPanels = private final Map<PatchSet.Id, PatchSetComplexDisclosurePanel> patchSetPanels =
new HashMap<PatchSet.Id, PatchSetComplexDisclosurePanel>(); new HashMap<>();
private final FlowPanel body; private final FlowPanel body;
private HandlerRegistration regNavigation; private HandlerRegistration regNavigation;
@@ -84,7 +84,7 @@ public class PatchSetsBlock extends Composite {
} }
} }
patchSetPanelsList = new ArrayList<PatchSetComplexDisclosurePanel>(); patchSetPanelsList = new ArrayList<>();
for (final PatchSet ps : patchSets) { for (final PatchSet ps : patchSets) {
final PatchSetComplexDisclosurePanel p = final PatchSetComplexDisclosurePanel p =

View File

@@ -105,7 +105,7 @@ public class PatchTable extends Composite {
private Map<Key, Integer> patchMap() { private Map<Key, Integer> patchMap() {
if (patchMap == null) { if (patchMap == null) {
patchMap = new HashMap<Patch.Key, Integer>(); patchMap = new HashMap<>();
for (int i = 0; i < patchList.size(); i++) { for (int i = 0; i < patchList.size(); i++) {
patchMap.put(patchList.get(i).getKey(), i); patchMap.put(patchList.get(i).getKey(), i);
} }
@@ -154,7 +154,7 @@ public class PatchTable extends Composite {
myTable.addClickHandler(clickHandler); myTable.addClickHandler(clickHandler);
} else { } else {
if (clickHandlers == null) { if (clickHandlers == null) {
clickHandlers = new ArrayList<ClickHandler>(2); clickHandlers = new ArrayList<>(2);
} }
clickHandlers.add(clickHandler); clickHandlers.add(clickHandler);
} }

View File

@@ -97,7 +97,7 @@ public class PublishCommentScreen extends AccountScreen implements
super.onInitUI(); super.onInitUI();
addStyleName(Gerrit.RESOURCES.css().publishCommentsScreen()); addStyleName(Gerrit.RESOURCES.css().publishCommentsScreen());
approvalButtons = new ArrayList<ValueRadioButton>(); approvalButtons = new ArrayList<>();
descBlock = new ChangeDescriptionBlock(null); descBlock = new ChangeDescriptionBlock(null);
add(descBlock); add(descBlock);
@@ -289,7 +289,7 @@ public class PublishCommentScreen extends AccountScreen implements
if (nativeValues == null || nativeValues.length() == 0) { if (nativeValues == null || nativeValues.length() == 0) {
return; return;
} }
List<String> values = new ArrayList<String>(nativeValues.length()); List<String> values = new ArrayList<>(nativeValues.length());
for (int i = 0; i < nativeValues.length(); i++) { for (int i = 0; i < nativeValues.length(); i++) {
values.add(nativeValues.get(i)); values.add(nativeValues.get(i));
} }
@@ -350,7 +350,7 @@ public class PublishCommentScreen extends AccountScreen implements
} }
draftsPanel.clear(); draftsPanel.clear();
commentEditors = new ArrayList<CommentEditorPanel>(); commentEditors = new ArrayList<>();
if (!drafts.isEmpty()) { if (!drafts.isEmpty()) {
draftsPanel.add(new SmallHeading(Util.C.headingPatchComments())); draftsPanel.add(new SmallHeading(Util.C.headingPatchComments()));
@@ -468,8 +468,8 @@ public class PublishCommentScreen extends AccountScreen implements
} }
private List<PatchLineComment> draftList() { private List<PatchLineComment> draftList() {
List<PatchLineComment> d = new ArrayList<PatchLineComment>(); List<PatchLineComment> d = new ArrayList<>();
List<String> paths = new ArrayList<String>(drafts.keySet()); List<String> paths = new ArrayList<>(drafts.keySet());
Collections.sort(paths); Collections.sort(paths);
for (String path : paths) { for (String path : paths) {
JsArray<CommentInfo> comments = drafts.get(path); JsArray<CommentInfo> comments = drafts.get(path);
@@ -512,7 +512,7 @@ public class PublishCommentScreen extends AccountScreen implements
SavedState(final PublishCommentScreen p) { SavedState(final PublishCommentScreen p) {
patchSetId = p.patchSetId; patchSetId = p.patchSetId;
message = p.message.getText(); message = p.message.getText();
approvals = new HashMap<String, String>(); approvals = new HashMap<>();
for (final ValueRadioButton b : p.approvalButtons) { for (final ValueRadioButton b : p.approvalButtons) {
if (b.getValue()) { if (b.getValue()) {
approvals.put(b.label.name(), b.value); approvals.put(b.label.name(), b.value);

View File

@@ -429,8 +429,8 @@ class PreferencesBox extends Composite {
private static final Map<String, String> NAME_TO_MODE; private static final Map<String, String> NAME_TO_MODE;
private static final Map<String, String> NORMALIZED_MODES; private static final Map<String, String> NORMALIZED_MODES;
static { static {
NAME_TO_MODE = new TreeMap<String, String>(); NAME_TO_MODE = new TreeMap<>();
NORMALIZED_MODES = new HashMap<String, String>(); NORMALIZED_MODES = new HashMap<>();
for (String type : ModeInjector.getKnownMimeTypes()) { for (String type : ModeInjector.getKnownMimeTypes()) {
String name = type; String name = type;
if (name.startsWith("text/x-")) { if (name.startsWith("text/x-")) {
@@ -459,7 +459,7 @@ class PreferencesBox extends Composite {
private void setMode(String modeType) { private void setMode(String modeType) {
if (modeType != null && !modeType.isEmpty()) { if (modeType != null && !modeType.isEmpty()) {
if (NORMALIZED_MODES.containsKey(modeType)) { if (NORMALIZED_MODES.containsKey(modeType)) {
modeType =NORMALIZED_MODES.get(modeType); modeType = NORMALIZED_MODES.get(modeType);
} }
for (int i = 0; i < mode.getItemCount(); i++) { for (int i = 0; i < mode.getItemCount(); i++) {
if (mode.getValue(i).equals(modeType)) { if (mode.getValue(i).equals(modeType)) {

View File

@@ -90,7 +90,7 @@ public class PatchSetSelectBox extends Composite {
this.idSideA = idSideA; this.idSideA = idSideA;
this.idSideB = idSideB; this.idSideB = idSideB;
this.idActive = (side == Side.A) ? idSideA : idSideB; this.idActive = (side == Side.A) ? idSideA : idSideB;
this.links = new HashMap<Integer, Anchor>(); this.links = new HashMap<>();
linkPanel.clear(); linkPanel.clear();

View File

@@ -327,7 +327,7 @@ public class RestApi {
private <T extends JavaScriptObject> void send( private <T extends JavaScriptObject> void send(
Method method, AsyncCallback<T> cb) { Method method, AsyncCallback<T> cb) {
HttpCallback<T> httpCallback = new HttpCallback<T>(background, cb); HttpCallback<T> httpCallback = new HttpCallback<>(background, cb);
try { try {
if (!background) { if (!background) {
RpcStatus.INSTANCE.onRpcStart(); RpcStatus.INSTANCE.onRpcStart();
@@ -367,7 +367,7 @@ public class RestApi {
private <T extends JavaScriptObject> void sendJSON( private <T extends JavaScriptObject> void sendJSON(
Method method, JavaScriptObject content, Method method, JavaScriptObject content,
AsyncCallback<T> cb) { AsyncCallback<T> cb) {
HttpCallback<T> httpCallback = new HttpCallback<T>(background, cb); HttpCallback<T> httpCallback = new HttpCallback<>(background, cb);
try { try {
if (!background) { if (!background) {
RpcStatus.INSTANCE.onRpcStart(); RpcStatus.INSTANCE.onRpcStart();
@@ -384,7 +384,7 @@ public class RestApi {
private <T extends JavaScriptObject> void sendRaw(Method method, String body, private <T extends JavaScriptObject> void sendRaw(Method method, String body,
AsyncCallback<T> cb) { AsyncCallback<T> cb) {
HttpCallback<T> httpCallback = new HttpCallback<T>(background, cb); HttpCallback<T> httpCallback = new HttpCallback<>(background, cb);
try { try {
if (!background) { if (!background) {
RpcStatus.INSTANCE.onRpcStart(); RpcStatus.INSTANCE.onRpcStart();

View File

@@ -50,8 +50,7 @@ public abstract class CherryPickDialog extends ActionDialog {
newBranch = new SuggestBox(new HighlightSuggestOracle() { newBranch = new SuggestBox(new HighlightSuggestOracle() {
@Override @Override
protected void onRequestSuggestions(Request request, Callback done) { protected void onRequestSuggestions(Request request, Callback done) {
LinkedList<BranchSuggestion> suggestions = LinkedList<BranchSuggestion> suggestions = new LinkedList<>();
new LinkedList<BranchSuggestion>();
for (final BranchInfo b : branches) { for (final BranchInfo b : branches) {
if (b.ref().contains(request.getQuery())) { if (b.ref().contains(request.getQuery())) {
suggestions.add(new BranchSuggestion(b)); suggestions.add(new BranchSuggestion(b));

View File

@@ -24,7 +24,7 @@ public class ScreenLoadEvent extends GwtEvent<ScreenLoadHandler> {
this.screen = screen; this.screen = screen;
} }
public static final Type<ScreenLoadHandler> TYPE = new Type<ScreenLoadHandler>(); public static final Type<ScreenLoadHandler> TYPE = new Type<>();
@Override @Override
protected void dispatch(ScreenLoadHandler handler) { protected void dispatch(ScreenLoadHandler handler) {

View File

@@ -50,7 +50,7 @@ class DirectChangeByCommit extends HttpServlet {
protected void doGet(final HttpServletRequest req, protected void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException { final HttpServletResponse rsp) throws IOException {
String query = CharMatcher.is('/').trimTrailingFrom(req.getPathInfo()); String query = CharMatcher.is('/').trimTrailingFrom(req.getPathInfo());
HashSet<Change.Id> ids = new HashSet<Change.Id>(); HashSet<Change.Id> ids = new HashSet<>();
try { try {
ChangeQueryBuilder builder = queryBuilder.create(currentUser.get()); ChangeQueryBuilder builder = queryBuilder.create(currentUser.get());
Predicate<ChangeData> visibleToMe = builder.is_visible(); Predicate<ChangeData> visibleToMe = builder.is_visible();

View File

@@ -152,7 +152,7 @@ class GerritConfigProvider implements Provider<GerritConfig> {
reportBugUrl : "http://code.google.com/p/gerrit/issues/list"); reportBugUrl : "http://code.google.com/p/gerrit/issues/list");
config.setReportBugText(cfg.getString("gerrit", null, "reportBugText")); config.setReportBugText(cfg.getString("gerrit", null, "reportBugText"));
final Set<Account.FieldName> fields = new HashSet<Account.FieldName>(); final Set<Account.FieldName> fields = new HashSet<>();
for (final Account.FieldName n : Account.FieldName.values()) { for (final Account.FieldName n : Account.FieldName.values()) {
if (realm.allowsEdit(n)) { if (realm.allowsEdit(n)) {
fields.add(n); fields.add(n);

View File

@@ -356,7 +356,7 @@ public class GitOverHttpServlet extends GitServlet {
if (isGet) { if (isGet) {
cache.put(cacheKey, Collections.unmodifiableSet( cache.put(cacheKey, Collections.unmodifiableSet(
new HashSet<ObjectId>(rp.getAdvertisedObjects()))); new HashSet<>(rp.getAdvertisedObjects())));
} }
} }

View File

@@ -231,7 +231,7 @@ class ProjectDigestFilter implements Filter {
} }
private Map<String, String> parseAuthorization(String auth) { private Map<String, String> parseAuthorization(String auth) {
Map<String, String> p = new HashMap<String, String>(); Map<String, String> p = new HashMap<>();
int next = "Digest ".length(); int next = "Digest ".length();
while (next < auth.length()) { while (next < auth.length()) {
if (next < auth.length() && auth.charAt(next) == ',') { if (next < auth.length() && auth.charAt(next) == ',') {

View File

@@ -98,7 +98,7 @@ class GitWebServlet extends HttpServlet {
this.projectControl = projectControl; this.projectControl = projectControl;
this.anonymousUserProvider = anonymousUserProvider; this.anonymousUserProvider = anonymousUserProvider;
this.gitwebCgi = gitWebConfig.getGitwebCGI(); this.gitwebCgi = gitWebConfig.getGitwebCGI();
this.deniedActions = new HashSet<String>(); this.deniedActions = new HashSet<>();
final String url = gitWebConfig.getUrl(); final String url = gitWebConfig.getUrl();
if ((url != null) && (!url.equals("gitweb"))) { if ((url != null) && (!url.equals("gitweb"))) {
@@ -398,7 +398,7 @@ class GitWebServlet extends HttpServlet {
} }
private static Map<String, String> getParameters(HttpServletRequest req) { private static Map<String, String> getParameters(HttpServletRequest req) {
final Map<String, String> params = new HashMap<String, String>(); final Map<String, String> params = new HashMap<>();
for (final String pair : req.getQueryString().split("[&;]")) { for (final String pair : req.getQueryString().split("[&;]")) {
final int eq = pair.indexOf('='); final int eq = pair.indexOf('=');
if (0 < eq) { if (0 < eq) {
@@ -669,11 +669,11 @@ class GitWebServlet extends HttpServlet {
private Map<String, String> envMap; private Map<String, String> envMap;
EnvList() { EnvList() {
envMap = new HashMap<String, String>(); envMap = new HashMap<>();
} }
EnvList(final EnvList l) { EnvList(final EnvList l) {
envMap = new HashMap<String, String>(l.envMap); envMap = new HashMap<>(l.envMap);
} }
/** Set a name/value pair, null values will be treated as an empty String */ /** Set a name/value pair, null values will be treated as an empty String */

View File

@@ -51,9 +51,9 @@ import javax.servlet.http.HttpServletResponse;
final class GerritJsonServlet extends JsonServlet<GerritJsonServlet.GerritCall> { final class GerritJsonServlet extends JsonServlet<GerritJsonServlet.GerritCall> {
private static final Logger log = LoggerFactory.getLogger(GerritJsonServlet.class); private static final Logger log = LoggerFactory.getLogger(GerritJsonServlet.class);
private static final ThreadLocal<GerritCall> currentCall = private static final ThreadLocal<GerritCall> currentCall =
new ThreadLocal<GerritCall>(); new ThreadLocal<>();
private static final ThreadLocal<MethodHandle> currentMethod = private static final ThreadLocal<MethodHandle> currentMethod =
new ThreadLocal<MethodHandle>(); new ThreadLocal<>();
private final Provider<WebSession> session; private final Provider<WebSession> session;
private final RemoteJsonService service; private final RemoteJsonService service;
private final AuditService audit; private final AuditService audit;

View File

@@ -137,8 +137,7 @@ class SuggestServiceImpl extends BaseServiceImplementation implements
final int max = 10; final int max = 10;
final int n = limit <= 0 ? max : Math.min(limit, max); final int n = limit <= 0 ? max : Math.min(limit, max);
final LinkedHashMap<Account.Id, AccountInfo> r = LinkedHashMap<Account.Id, AccountInfo> r = new LinkedHashMap<>();
new LinkedHashMap<Account.Id, AccountInfo>();
for (final Account p : db.accounts().suggestByFullName(a, b, n)) { for (final Account p : db.accounts().suggestByFullName(a, b, n)) {
addSuggestion(r, p, new AccountInfo(p), active, visibilityControl); addSuggestion(r, p, new AccountInfo(p), active, visibilityControl);
} }
@@ -159,7 +158,7 @@ class SuggestServiceImpl extends BaseServiceImplementation implements
} }
} }
} }
return new ArrayList<AccountInfo>(r.values()); return new ArrayList<>(r.values());
} }
private void addSuggestion(Map<Account.Id, AccountInfo> map, Account account, private void addSuggestion(Map<Account.Id, AccountInfo> map, Account account,
@@ -251,7 +250,7 @@ class SuggestServiceImpl extends BaseServiceImplementation implements
final List<AccountInfo> suggestedAccounts = final List<AccountInfo> suggestedAccounts =
suggestAccount(db, query, Boolean.TRUE, limit, visibilityControl); suggestAccount(db, query, Boolean.TRUE, limit, visibilityControl);
final List<ReviewerInfo> reviewer = final List<ReviewerInfo> reviewer =
new ArrayList<ReviewerInfo>(suggestedAccounts.size()); new ArrayList<>(suggestedAccounts.size());
for (final AccountInfo a : suggestedAccounts) { for (final AccountInfo a : suggestedAccounts) {
reviewer.add(new ReviewerInfo(a)); reviewer.add(new ReviewerInfo(a));
} }

View File

@@ -72,7 +72,7 @@ class SystemInfoServiceImpl implements SystemInfoService {
} }
public void daemonHostKeys(final AsyncCallback<List<SshHostKey>> callback) { public void daemonHostKeys(final AsyncCallback<List<SshHostKey>> callback) {
final ArrayList<SshHostKey> r = new ArrayList<SshHostKey>(hostKeys.size()); final ArrayList<SshHostKey> r = new ArrayList<>(hostKeys.size());
for (final HostKey hk : hostKeys) { for (final HostKey hk : hostKeys) {
String host = hk.getHost(); String host = hk.getHost();
if (host.startsWith("*:")) { if (host.startsWith("*:")) {

View File

@@ -113,8 +113,7 @@ class AccountServiceImpl extends BaseServiceImplementation implements
final AsyncCallback<List<AccountProjectWatchInfo>> callback) { final AsyncCallback<List<AccountProjectWatchInfo>> callback) {
run(callback, new Action<List<AccountProjectWatchInfo>>() { run(callback, new Action<List<AccountProjectWatchInfo>>() {
public List<AccountProjectWatchInfo> run(ReviewDb db) throws OrmException { public List<AccountProjectWatchInfo> run(ReviewDb db) throws OrmException {
final List<AccountProjectWatchInfo> r = List<AccountProjectWatchInfo> r = new ArrayList<>();
new ArrayList<AccountProjectWatchInfo>();
for (final AccountProjectWatch w : db.accountProjectWatches() for (final AccountProjectWatch w : db.accountProjectWatches()
.byAccount(getAccountId()).toList()) { .byAccount(getAccountId()).toList()) {

View File

@@ -63,7 +63,7 @@ class DeleteExternalIds extends Handler<Set<AccountExternalId.Key>> {
public Set<AccountExternalId.Key> call() throws OrmException { public Set<AccountExternalId.Key> call() throws OrmException {
final Map<AccountExternalId.Key, AccountExternalId> have = have(); final Map<AccountExternalId.Key, AccountExternalId> have = have();
List<AccountExternalId> toDelete = new ArrayList<AccountExternalId>(); List<AccountExternalId> toDelete = new ArrayList<>();
for (AccountExternalId.Key k : keys) { for (AccountExternalId.Key k : keys) {
final AccountExternalId id = have.get(k); final AccountExternalId id = have.get(k);
if (id != null && id.canDelete()) { if (id != null && id.canDelete()) {
@@ -86,7 +86,7 @@ class DeleteExternalIds extends Handler<Set<AccountExternalId.Key>> {
throws OrmException { throws OrmException {
Map<AccountExternalId.Key, AccountExternalId> r; Map<AccountExternalId.Key, AccountExternalId> r;
r = new HashMap<AccountExternalId.Key, AccountExternalId>(); r = new HashMap<>();
for (AccountExternalId i : detailFactory.call()) { for (AccountExternalId i : detailFactory.call()) {
r.put(i.getKey(), i); r.put(i.getKey(), i);
} }
@@ -94,7 +94,7 @@ class DeleteExternalIds extends Handler<Set<AccountExternalId.Key>> {
} }
private Set<AccountExternalId.Key> toKeySet(List<AccountExternalId> toDelete) { private Set<AccountExternalId.Key> toKeySet(List<AccountExternalId> toDelete) {
Set<AccountExternalId.Key> r = new HashSet<AccountExternalId.Key>(); Set<AccountExternalId.Key> r = new HashSet<>();
for (AccountExternalId i : toDelete) { for (AccountExternalId i : toDelete) {
r.add(i.getKey()); r.add(i.getKey());
} }

View File

@@ -138,7 +138,7 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
} }
final List<Patch> patches = list.toPatchList(patchSet.getId()); final List<Patch> patches = list.toPatchList(patchSet.getId());
final Map<Patch.Key, Patch> byKey = new HashMap<Patch.Key, Patch>(); final Map<Patch.Key, Patch> byKey = new HashMap<>();
for (final Patch p : patches) { for (final Patch p : patches) {
byKey.put(p.getKey(), p); byKey.put(p.getKey(), p);
} }

View File

@@ -114,8 +114,8 @@ class ProjectAccessFactory extends Handler<ProjectAccess> {
} }
final RefControl metaConfigControl = pc.controlForRef(RefNames.REFS_CONFIG); final RefControl metaConfigControl = pc.controlForRef(RefNames.REFS_CONFIG);
List<AccessSection> local = new ArrayList<AccessSection>(); List<AccessSection> local = new ArrayList<>();
Set<String> ownerOf = new HashSet<String>(); Set<String> ownerOf = new HashSet<>();
Map<AccountGroup.UUID, Boolean> visibleGroups = new HashMap<>(); Map<AccountGroup.UUID, Boolean> visibleGroups = new HashMap<>();
for (AccessSection section : config.getAccessSections()) { for (AccessSection section : config.getAccessSections()) {

View File

@@ -185,7 +185,7 @@ public abstract class ProjectAccessHandler<T> extends Handler<T> {
} }
private static Set<String> scanSectionNames(ProjectConfig config) { private static Set<String> scanSectionNames(ProjectConfig config) {
Set<String> names = new HashSet<String>(); Set<String> names = new HashSet<>();
for (AccessSection section : config.getAccessSections()) { for (AccessSection section : config.getAccessSections()) {
names.add(section.getName()); names.add(section.getName());
} }

View File

@@ -182,7 +182,7 @@ public class ReviewProjectAccess extends ProjectAccessHandler<Change.Id> {
private void insertAncestors(PatchSet.Id id, RevCommit src) private void insertAncestors(PatchSet.Id id, RevCommit src)
throws OrmException { throws OrmException {
final int cnt = src.getParentCount(); final int cnt = src.getParentCount();
List<PatchSetAncestor> toInsert = new ArrayList<PatchSetAncestor>(cnt); List<PatchSetAncestor> toInsert = new ArrayList<>(cnt);
for (int p = 0; p < cnt; p++) { for (int p = 0; p < cnt; p++) {
PatchSetAncestor a; PatchSetAncestor a;

View File

@@ -192,7 +192,7 @@ public final class GerritLauncher {
throw e; throw e;
} }
final SortedMap<String, URL> jars = new TreeMap<String, URL>(); final SortedMap<String, URL> jars = new TreeMap<>();
try { try {
final ZipFile zf = new ZipFile(path); final ZipFile zf = new ZipFile(path);
try { try {
@@ -220,7 +220,7 @@ public final class GerritLauncher {
// The extension API needs to be its own ClassLoader, along // The extension API needs to be its own ClassLoader, along
// with a few of its dependencies. Try to construct this first. // with a few of its dependencies. Try to construct this first.
List<URL> extapi = new ArrayList<URL>(); List<URL> extapi = new ArrayList<>();
move(jars, "gerrit-extension-api-", extapi); move(jars, "gerrit-extension-api-", extapi);
move(jars, "guice-", extapi); move(jars, "guice-", extapi);
move(jars, "javax.inject-1.jar", extapi); move(jars, "javax.inject-1.jar", extapi);
@@ -592,7 +592,7 @@ public final class GerritLauncher {
private static ClassLoader useDevClasspath() private static ClassLoader useDevClasspath()
throws MalformedURLException, FileNotFoundException { throws MalformedURLException, FileNotFoundException {
File out = getDeveloperBuckOut(); File out = getDeveloperBuckOut();
List<URL> dirs = new ArrayList<URL>(); List<URL> dirs = new ArrayList<>();
dirs.add(new File(new File(out, "eclipse"), "classes").toURI().toURL()); dirs.add(new File(new File(out, "eclipse"), "classes").toURI().toURL());
ClassLoader cl = GerritLauncher.class.getClassLoader(); ClassLoader cl = GerritLauncher.class.getClassLoader();
for (URL u : ((URLClassLoader) cl).getURLs()) { for (URL u : ((URLClassLoader) cl).getURLs()) {

View File

@@ -185,7 +185,7 @@ public class BaseInit extends SiteProgram {
private SiteInit createSiteInit() { private SiteInit createSiteInit() {
final ConsoleUI ui = getConsoleUI(); final ConsoleUI ui = getConsoleUI();
final File sitePath = getSitePath(); final File sitePath = getSitePath();
final List<Module> m = new ArrayList<Module>(); final List<Module> m = new ArrayList<>();
m.add(new InitModule(standalone, initDb)); m.add(new InitModule(standalone, initDb));
m.add(new AbstractModule() { m.add(new AbstractModule() {
@@ -250,7 +250,7 @@ public class BaseInit extends SiteProgram {
} }
void upgradeSchema() throws OrmException { void upgradeSchema() throws OrmException {
final List<String> pruneList = new ArrayList<String>(); final List<String> pruneList = new ArrayList<>();
schemaUpdater.update(new UpdateUI() { schemaUpdater.update(new UpdateUI() {
@Override @Override
public void message(String msg) { public void message(String msg) {
@@ -316,7 +316,7 @@ public class BaseInit extends SiteProgram {
} }
private Injector createSysInjector(final SiteInit init) { private Injector createSysInjector(final SiteInit init) {
final List<Module> modules = new ArrayList<Module>(); final List<Module> modules = new ArrayList<>();
modules.add(new AbstractModule() { modules.add(new AbstractModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@@ -303,13 +303,13 @@ public class Daemon extends SiteProgram {
} }
private Injector createCfgInjector() { private Injector createCfgInjector() {
final List<Module> modules = new ArrayList<Module>(); final List<Module> modules = new ArrayList<>();
modules.add(new AuthConfigModule()); modules.add(new AuthConfigModule());
return dbInjector.createChildInjector(modules); return dbInjector.createChildInjector(modules);
} }
private Injector createSysInjector() { private Injector createSysInjector() {
final List<Module> modules = new ArrayList<Module>(); final List<Module> modules = new ArrayList<>();
modules.add(SchemaVersionCheck.module()); modules.add(SchemaVersionCheck.module());
modules.add(new LogFileCompressor.Module()); modules.add(new LogFileCompressor.Module());
modules.add(new WorkQueue.Module()); modules.add(new WorkQueue.Module());
@@ -376,7 +376,7 @@ public class Daemon extends SiteProgram {
} }
private Injector createSshInjector() { private Injector createSshInjector() {
final List<Module> modules = new ArrayList<Module>(); final List<Module> modules = new ArrayList<>();
modules.add(sysInjector.getInstance(SshModule.class)); modules.add(sysInjector.getInstance(SshModule.class));
if (!test) { if (!test) {
modules.add(new SshHostKeyModule()); modules.add(new SshHostKeyModule());
@@ -401,7 +401,7 @@ public class Daemon extends SiteProgram {
} }
private Injector createWebInjector() { private Injector createWebInjector() {
final List<Module> modules = new ArrayList<Module>(); final List<Module> modules = new ArrayList<>();
if (sshd) { if (sshd) {
modules.add(new ProjectQoSFilter.Module()); modules.add(new ProjectQoSFilter.Module());
} }
@@ -429,7 +429,7 @@ public class Daemon extends SiteProgram {
} }
private Injector createHttpdInjector() { private Injector createHttpdInjector() {
final List<Module> modules = new ArrayList<Module>(); final List<Module> modules = new ArrayList<>();
modules.add(new JettyModule(new JettyEnv(webInjector))); modules.add(new JettyModule(new JettyEnv(webInjector)));
return webInjector.createChildInjector(modules); return webInjector.createChildInjector(modules);
} }

View File

@@ -70,7 +70,7 @@ public class LocalUsernamesToLowerCase extends SiteProgram {
db.close(); db.close();
} }
final List<Worker> workers = new ArrayList<Worker>(threads); final List<Worker> workers = new ArrayList<>(threads);
for (int tid = 0; tid < threads; tid++) { for (int tid = 0; tid < threads; tid++) {
Worker t = new Worker(); Worker t = new Worker();
t.start(); t.start();

View File

@@ -33,7 +33,7 @@ import java.util.List;
public class PrologShell extends AbstractProgram { public class PrologShell extends AbstractProgram {
@Option(name = "-s", metaVar = "FILE.pl", usage = "file to load") @Option(name = "-s", metaVar = "FILE.pl", usage = "file to load")
private List<String> fileName = new ArrayList<String>(); private List<String> fileName = new ArrayList<>();
@Override @Override
public int run() { public int run() {

View File

@@ -252,7 +252,7 @@ public class Reindex extends SiteProgram {
Key.get(new TypeLiteral<SchemaFactory<ReviewDb>>() {})); Key.get(new TypeLiteral<SchemaFactory<ReviewDb>>() {}));
final List<ReviewDb> dbs = Collections.synchronizedList( final List<ReviewDb> dbs = Collections.synchronizedList(
Lists.<ReviewDb> newArrayListWithCapacity(threads + 1)); Lists.<ReviewDb> newArrayListWithCapacity(threads + 1));
final ThreadLocal<ReviewDb> localDb = new ThreadLocal<ReviewDb>(); final ThreadLocal<ReviewDb> localDb = new ThreadLocal<>();
bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() { bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() {
@Override @Override

View File

@@ -47,7 +47,7 @@ public class Rulec extends SiteProgram {
private boolean quiet; private boolean quiet;
@Argument(index = 0, multiValued = true, metaVar = "PROJECT", usage = "project to compile rules for") @Argument(index = 0, multiValued = true, metaVar = "PROJECT", usage = "project to compile rules for")
private List<String> projectNames = new ArrayList<String>(); private List<String> projectNames = new ArrayList<>();
private Injector dbInjector; private Injector dbInjector;
@@ -71,7 +71,7 @@ public class Rulec extends SiteProgram {
} }
}).injectMembers(this); }).injectMembers(this);
LinkedHashSet<Project.NameKey> names = new LinkedHashSet<Project.NameKey>(); LinkedHashSet<Project.NameKey> names = new LinkedHashSet<>();
for (String name : projectNames) { for (String name : projectNames) {
names.add(new Project.NameKey(name)); names.add(new Project.NameKey(name));
} }

View File

@@ -371,7 +371,7 @@ public class JettyServer {
private Handler makeContext(final JettyEnv env, final Config cfg) private Handler makeContext(final JettyEnv env, final Config cfg)
throws MalformedURLException, IOException { throws MalformedURLException, IOException {
final Set<String> paths = new HashSet<String>(); final Set<String> paths = new HashSet<>();
for (URI u : listenURLs(cfg)) { for (URI u : listenURLs(cfg)) {
String p = u.getPath(); String p = u.getPath();
if (p == null || p.isEmpty()) { if (p == null || p.isEmpty()) {
@@ -383,7 +383,7 @@ public class JettyServer {
paths.add(p); paths.add(p);
} }
final List<ContextHandler> all = new ArrayList<ContextHandler>(); final List<ContextHandler> all = new ArrayList<>();
for (String path : paths) { for (String path : paths) {
all.add(makeContext(path, env, cfg)); all.add(makeContext(path, env, cfg));
} }

View File

@@ -54,7 +54,7 @@ public class InitPluginStepsLoader {
public Collection<InitStep> getInitSteps() { public Collection<InitStep> getInitSteps() {
List<File> jars = scanJarsInPluginsDirectory(); List<File> jars = scanJarsInPluginsDirectory();
ArrayList<InitStep> pluginsInitSteps = new ArrayList<InitStep>(); ArrayList<InitStep> pluginsInitSteps = new ArrayList<>();
for (File jar : jars) { for (File jar : jars) {
InitStep init = loadInitStep(jar); InitStep init = loadInitStep(jar);

View File

@@ -55,7 +55,7 @@ public class Section {
} }
public void set(final String name, final String value) { public void set(final String name, final String value) {
final ArrayList<String> all = new ArrayList<String>(); final ArrayList<String> all = new ArrayList<>();
all.addAll(Arrays.asList(flags.cfg.getStringList(section, subsection, name))); all.addAll(Arrays.asList(flags.cfg.getStringList(section, subsection, name)));
if (value != null) { if (value != null) {

View File

@@ -125,7 +125,7 @@ public class SitePathInitializer {
} }
private static List<InitStep> stepsOf(final Injector injector) { private static List<InitStep> stepsOf(final Injector injector) {
final ArrayList<InitStep> r = new ArrayList<InitStep>(); final ArrayList<InitStep> r = new ArrayList<>();
for (Binding<InitStep> b : all(injector)) { for (Binding<InitStep> b : all(injector)) {
r.add(b.getProvider().get()); r.add(b.getProvider().get());
} }

View File

@@ -85,7 +85,7 @@ public class JythonShell {
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw noInterpreter(e); throw noInterpreter(e);
} }
injectedVariables = new ArrayList<String>(); injectedVariables = new ArrayList<>();
set("Shell", this); set("Shell", this);
} }

View File

@@ -46,7 +46,7 @@ public class RuntimeShutdown {
private static final Logger log = private static final Logger log =
LoggerFactory.getLogger(ShutdownCallback.class); LoggerFactory.getLogger(ShutdownCallback.class);
private final List<Runnable> tasks = new ArrayList<Runnable>(); private final List<Runnable> tasks = new ArrayList<>();
private boolean shutdownStarted; private boolean shutdownStarted;
private boolean shutdownComplete; private boolean shutdownComplete;

View File

@@ -90,7 +90,7 @@ public abstract class SiteProgram extends AbstractProgram {
/** @return provides database connectivity and site path. */ /** @return provides database connectivity and site path. */
protected Injector createDbInjector(final DataSourceProvider.Context context) { protected Injector createDbInjector(final DataSourceProvider.Context context) {
final File sitePath = getSitePath(); final File sitePath = getSitePath();
final List<Module> modules = new ArrayList<Module>(); final List<Module> modules = new ArrayList<>();
Module sitePathModule = new AbstractModule() { Module sitePathModule = new AbstractModule() {
@Override @Override

View File

@@ -27,7 +27,7 @@ public class HelloMenu implements TopMenu {
@Inject @Inject
public HelloMenu(@PluginName String pluginName) { public HelloMenu(@PluginName String pluginName) {
menuEntries = new ArrayList<TopMenu.MenuEntry>(); menuEntries = new ArrayList<>();
menuEntries.add(new MenuEntry("Hello", Collections menuEntries.add(new MenuEntry("Hello", Collections
.singletonList(new MenuItem("Hello Screen", "#/x/" + pluginName, "")))); .singletonList(new MenuItem("Hello Screen", "#/x/" + pluginName, ""))));
} }

View File

@@ -125,7 +125,7 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
public void format(SparseFileContent src) { public void format(SparseFileContent src) {
content = new SparseFileContent(); content = new SparseFileContent();
content.setSize(src.size()); content.setSize(src.size());
trailingEdits = new HashSet<Integer>(); trailingEdits = new HashSet<>();
String html = toHTML(src); String html = toHTML(src);
@@ -365,7 +365,7 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
// in the source. That simplifies our loop below because we'll never // in the source. That simplifies our loop below because we'll never
// run off the end of the edit list. // run off the end of the edit list.
// //
List<Edit> edits = new ArrayList<Edit>(this.edits.size() + 1); List<Edit> edits = new ArrayList<>(this.edits.size() + 1);
edits.addAll(this.edits); edits.addAll(this.edits);
edits.add(new Edit(src.size(), src.size())); edits.add(new Edit(src.size(), src.size()));

View File

@@ -29,7 +29,7 @@ public class SparseFileContent {
private transient int currentRangeIdx; private transient int currentRangeIdx;
public SparseFileContent() { public SparseFileContent() {
ranges = new ArrayList<Range>(); ranges = new ArrayList<>();
} }
public int size() { public int size() {
@@ -222,7 +222,7 @@ public class SparseFileContent {
public SparseFileContent apply(SparseFileContent a, List<Edit> edits) { public SparseFileContent apply(SparseFileContent a, List<Edit> edits) {
EditList list = new EditList(edits, size, a.size(), size); EditList list = new EditList(edits, size, a.size(), size);
ArrayList<String> lines = new ArrayList<String>(size); ArrayList<String> lines = new ArrayList<>(size);
for (final EditList.Hunk hunk : list.getHunks()) { for (final EditList.Hunk hunk : list.getHunks()) {
while (hunk.next()) { while (hunk.next()) {
if (hunk.isContextLine()) { if (hunk.isContextLine()) {
@@ -277,7 +277,7 @@ public class SparseFileContent {
private Range(final int b) { private Range(final int b) {
base = b; base = b;
lines = new ArrayList<String>(); lines = new ArrayList<>();
} }
protected Range() { protected Range() {

View File

@@ -156,7 +156,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
/** Listeners to receive changes as they happen (limited by visibility /** Listeners to receive changes as they happen (limited by visibility
* of holder's user). */ * of holder's user). */
private final Map<ChangeListener, ChangeListenerHolder> listeners = private final Map<ChangeListener, ChangeListenerHolder> listeners =
new ConcurrentHashMap<ChangeListener, ChangeListenerHolder>(); new ConcurrentHashMap<>();
/** Listeners to receive all changes as they happen. */ /** Listeners to receive all changes as they happen. */
private final DynamicSet<ChangeListener> unrestrictedListeners; private final DynamicSet<ChangeListener> unrestrictedListeners;
@@ -320,7 +320,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
public HookResult doRefUpdateHook(final Project project, final String refname, public HookResult doRefUpdateHook(final Project project, final String refname,
final Account uploader, final ObjectId oldId, final ObjectId newId) { final Account uploader, final ObjectId oldId, final ObjectId newId) {
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--project", project.getName()); addArg(args, "--project", project.getName());
addArg(args, "--refname", refname); addArg(args, "--refname", refname);
addArg(args, "--uploader", getDisplayName(uploader)); addArg(args, "--uploader", getDisplayName(uploader));
@@ -355,7 +355,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.uploader = eventFactory.asAccountAttribute(uploader.getAccount()); event.uploader = eventFactory.asAccountAttribute(uploader.getAccount());
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--is-draft", patchSet.isDraft() ? "true" : "false"); addArg(args, "--is-draft", patchSet.isDraft() ? "true" : "false");
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
@@ -379,7 +379,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.uploader = eventFactory.asAccountAttribute(uploader.getAccount()); event.uploader = eventFactory.asAccountAttribute(uploader.getAccount());
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
addArg(args, "--project", event.change.project); addArg(args, "--project", event.change.project);
@@ -413,7 +413,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--is-draft", patchSet.isDraft() ? "true" : "false"); addArg(args, "--is-draft", patchSet.isDraft() ? "true" : "false");
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
@@ -442,7 +442,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.patchSet = eventFactory.asPatchSetAttribute(patchSet); event.patchSet = eventFactory.asPatchSetAttribute(patchSet);
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
addArg(args, "--project", event.change.project); addArg(args, "--project", event.change.project);
@@ -465,7 +465,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.reason = reason; event.reason = reason;
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
addArg(args, "--project", event.change.project); addArg(args, "--project", event.change.project);
@@ -489,7 +489,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.reason = reason; event.reason = reason;
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
addArg(args, "--project", event.change.project); addArg(args, "--project", event.change.project);
@@ -513,7 +513,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.reason = reason; event.reason = reason;
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
addArg(args, "--project", event.change.project); addArg(args, "--project", event.change.project);
@@ -539,7 +539,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.refUpdate = eventFactory.asRefUpdateAttribute(oldId, newId, refName); event.refUpdate = eventFactory.asRefUpdateAttribute(oldId, newId, refName);
fireEvent(refName, event); fireEvent(refName, event);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--oldrev", event.refUpdate.oldRev); addArg(args, "--oldrev", event.refUpdate.oldRev);
addArg(args, "--newrev", event.refUpdate.newRev); addArg(args, "--newrev", event.refUpdate.newRev);
addArg(args, "--refname", event.refUpdate.refName); addArg(args, "--refname", event.refUpdate.refName);
@@ -560,7 +560,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.reviewer = eventFactory.asAccountAttribute(account); event.reviewer = eventFactory.asAccountAttribute(account);
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--change-url", event.change.url); addArg(args, "--change-url", event.change.url);
addArg(args, "--project", event.change.project); addArg(args, "--project", event.change.project);
@@ -580,7 +580,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
event.oldTopic = oldTopic; event.oldTopic = oldTopic;
fireEvent(change, event, db); fireEvent(change, event, db);
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--change", event.change.id); addArg(args, "--change", event.change.id);
addArg(args, "--project", event.change.project); addArg(args, "--project", event.change.project);
addArg(args, "--branch", event.change.branch); addArg(args, "--branch", event.change.branch);
@@ -593,7 +593,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
public void doClaSignupHook(Account account, ContributorAgreement cla) { public void doClaSignupHook(Account account, ContributorAgreement cla) {
if (account != null) { if (account != null) {
final List<String> args = new ArrayList<String>(); final List<String> args = new ArrayList<>();
addArg(args, "--submitter", getDisplayName(account)); addArg(args, "--submitter", getDisplayName(account));
addArg(args, "--user-id", account.getId().toString()); addArg(args, "--user-id", account.getId().toString());
addArg(args, "--cla-name", cla.getName()); addArg(args, "--cla-name", cla.getName());
@@ -721,7 +721,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
} }
SyncHookTask syncHook = new SyncHookTask(project, hook, args); SyncHookTask syncHook = new SyncHookTask(project, hook, args);
FutureTask<HookResult> task = new FutureTask<HookResult>(syncHook); FutureTask<HookResult> task = new FutureTask<>(syncHook);
syncHookThreadPool.execute(task); syncHookThreadPool.execute(task);
@@ -781,7 +781,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
HookResult result = null; HookResult result = null;
try { try {
final List<String> argv = new ArrayList<String>(1 + args.size()); final List<String> argv = new ArrayList<>(1 + args.size());
argv.add(hook.getAbsolutePath()); argv.add(hook.getAbsolutePath());
argv.addAll(args); argv.addAll(args);

View File

@@ -154,13 +154,13 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
} }
DiagnosticCollector<JavaFileObject> diagnostics = DiagnosticCollector<JavaFileObject> diagnostics =
new DiagnosticCollector<JavaFileObject>(); new DiagnosticCollector<>();
StandardJavaFileManager fileManager = StandardJavaFileManager fileManager =
compiler.getStandardFileManager(diagnostics, null, null); compiler.getStandardFileManager(diagnostics, null, null);
try { try {
Iterable<? extends JavaFileObject> compilationUnits = fileManager Iterable<? extends JavaFileObject> compilationUnits = fileManager
.getJavaFileObjectsFromFiles(getAllFiles(tempDir, ".java")); .getJavaFileObjectsFromFiles(getAllFiles(tempDir, ".java"));
ArrayList<String> options = new ArrayList<String>(); ArrayList<String> options = new ArrayList<>();
String classpath = getMyClasspath(); String classpath = getMyClasspath();
if (classpath != null) { if (classpath != null) {
options.add("-classpath"); options.add("-classpath");
@@ -270,7 +270,7 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
} }
private List<File> getAllFiles(File dir, String extension) { private List<File> getAllFiles(File dir, String extension) {
ArrayList<File> fileList = new ArrayList<File>(); ArrayList<File> fileList = new ArrayList<>();
getAllFiles(dir, extension, fileList); getAllFiles(dir, extension, fileList);
return fileList; return fileList;
} }
@@ -287,7 +287,7 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
} }
private List<String> getRelativePaths(File dir, String extension) { private List<String> getRelativePaths(File dir, String extension) {
ArrayList<String> pathList = new ArrayList<String>(); ArrayList<String> pathList = new ArrayList<>();
getRelativePaths(dir, extension, "", pathList); getRelativePaths(dir, extension, "", pathList);
return pathList; return pathList;
} }

View File

@@ -73,8 +73,8 @@ public class PrologEnvironment extends BufferingPrologControl {
setMaxArity(MAX_ARITY); setMaxArity(MAX_ARITY);
setEnabled(EnumSet.allOf(Prolog.Feature.class), false); setEnabled(EnumSet.allOf(Prolog.Feature.class), false);
args = a; args = a;
storedValues = new HashMap<StoredValue<Object>, Object>(); storedValues = new HashMap<>();
cleanup = new LinkedList<Runnable>(); cleanup = new LinkedList<>();
} }
public Args getArgs() { public Args getArgs() {

View File

@@ -80,11 +80,10 @@ public class RulesCache {
private static final List<String> PACKAGE_LIST = ImmutableList.of( private static final List<String> PACKAGE_LIST = ImmutableList.of(
Prolog.BUILTIN, "gerrit"); Prolog.BUILTIN, "gerrit");
private final Map<ObjectId, MachineRef> machineCache = private final Map<ObjectId, MachineRef> machineCache = new HashMap<>();
new HashMap<ObjectId, MachineRef>();
private final ReferenceQueue<PrologMachineCopy> dead = private final ReferenceQueue<PrologMachineCopy> dead =
new ReferenceQueue<PrologMachineCopy>(); new ReferenceQueue<>();
private static final class MachineRef extends WeakReference<PrologMachineCopy> { private static final class MachineRef extends WeakReference<PrologMachineCopy> {
final ObjectId key; final ObjectId key;

View File

@@ -25,12 +25,12 @@ import com.googlecode.prolog_cafe.lang.SystemException;
public class StoredValue<T> { public class StoredValue<T> {
/** Construct a new unique key that does not match any other key. */ /** Construct a new unique key that does not match any other key. */
public static <T> StoredValue<T> create() { public static <T> StoredValue<T> create() {
return new StoredValue<T>(); return new StoredValue<>();
} }
/** Construct a key based on a Java Class object, useful for singletons. */ /** Construct a key based on a Java Class object, useful for singletons. */
public static <T> StoredValue<T> create(Class<T> clazz) { public static <T> StoredValue<T> create(Class<T> clazz) {
return new StoredValue<T>(clazz); return new StoredValue<>(clazz);
} }
private final Object key; private final Object key;

View File

@@ -147,7 +147,7 @@ public class ChangeUtil {
public static void insertAncestors(ReviewDb db, PatchSet.Id id, RevCommit src) public static void insertAncestors(ReviewDb db, PatchSet.Id id, RevCommit src)
throws OrmException { throws OrmException {
int cnt = src.getParentCount(); int cnt = src.getParentCount();
List<PatchSetAncestor> toInsert = new ArrayList<PatchSetAncestor>(cnt); List<PatchSetAncestor> toInsert = new ArrayList<>(cnt);
for (int p = 0; p < cnt; p++) { for (int p = 0; p < cnt; p++) {
PatchSetAncestor a = PatchSetAncestor a =
new PatchSetAncestor(new PatchSetAncestor.Id(id, p + 1)); new PatchSetAncestor(new PatchSetAncestor.Id(id, p + 1));

View File

@@ -94,7 +94,7 @@ public class MimeUtilFileTypeRegistry implements FileTypeRegistry {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public MimeType getMimeType(final String path, final byte[] content) { public MimeType getMimeType(final String path, final byte[] content) {
Set<MimeType> mimeTypes = new HashSet<MimeType>(); Set<MimeType> mimeTypes = new HashSet<>();
if (content != null && content.length > 0) { if (content != null && content.length > 0) {
try { try {
mimeTypes.addAll(mimeUtil.getMimeTypes(content)); mimeTypes.addAll(mimeUtil.getMimeTypes(content));
@@ -112,7 +112,7 @@ public class MimeUtilFileTypeRegistry implements FileTypeRegistry {
return MimeUtil2.UNKNOWN_MIME_TYPE; return MimeUtil2.UNKNOWN_MIME_TYPE;
} }
final List<MimeType> types = new ArrayList<MimeType>(mimeTypes); final List<MimeType> types = new ArrayList<>(mimeTypes);
Collections.sort(types, new Comparator<MimeType>() { Collections.sort(types, new Comparator<MimeType>() {
@Override @Override
public int compare(MimeType a, MimeType b) { public int compare(MimeType a, MimeType b) {

View File

@@ -32,7 +32,7 @@ public class RequestCleanup implements Runnable {
private static final Logger log = private static final Logger log =
LoggerFactory.getLogger(RequestCleanup.class); LoggerFactory.getLogger(RequestCleanup.class);
private final List<Runnable> cleanup = new LinkedList<Runnable>(); private final List<Runnable> cleanup = new LinkedList<>();
private boolean ran; private boolean ran;
/** Register a task to be completed after the request ends. */ /** Register a task to be completed after the request ends. */

View File

@@ -157,8 +157,7 @@ public class ListAccess implements RestReadView<TopLevelResource> {
pc.controlForRef(RefNames.REFS_CONFIG); pc.controlForRef(RefNames.REFS_CONFIG);
local = Maps.newHashMap(); local = Maps.newHashMap();
ownerOf = Sets.newHashSet(); ownerOf = Sets.newHashSet();
Map<AccountGroup.UUID, Boolean> visibleGroups = Map<AccountGroup.UUID, Boolean> visibleGroups = new HashMap<>();
new HashMap<AccountGroup.UUID, Boolean>();
for (AccessSection section : config.getAccessSections()) { for (AccessSection section : config.getAccessSections()) {
String name = section.getName(); String name = section.getName();

View File

@@ -163,7 +163,7 @@ public class AccountCacheImpl implements AccountCache {
Collections.unmodifiableCollection(db.accountExternalIds().byAccount( Collections.unmodifiableCollection(db.accountExternalIds().byAccount(
who).toList()); who).toList());
Set<AccountGroup.UUID> internalGroups = new HashSet<AccountGroup.UUID>(); Set<AccountGroup.UUID> internalGroups = new HashSet<>();
for (AccountGroupMember g : db.accountGroupMembers().byAccount(who)) { for (AccountGroupMember g : db.accountGroupMembers().byAccount(who)) {
final AccountGroup.Id groupId = g.getAccountGroupId(); final AccountGroup.Id groupId = g.getAccountGroupId();
final AccountGroup group = groupCache.get(groupId); final AccountGroup group = groupCache.get(groupId);

View File

@@ -36,7 +36,7 @@ public class AccountInfoCacheFactory {
@Inject @Inject
AccountInfoCacheFactory(final AccountCache accountCache) { AccountInfoCacheFactory(final AccountCache accountCache) {
this.accountCache = accountCache; this.accountCache = accountCache;
this.out = new HashMap<Account.Id, Account>(); this.out = new HashMap<>();
} }
/** /**
@@ -66,7 +66,7 @@ public class AccountInfoCacheFactory {
* Create an AccountInfoCache with the currently loaded Account entities. * Create an AccountInfoCache with the currently loaded Account entities.
* */ * */
public AccountInfoCache create() { public AccountInfoCache create() {
final List<AccountInfo> r = new ArrayList<AccountInfo>(out.size()); final List<AccountInfo> r = new ArrayList<>(out.size());
for (final Account a : out.values()) { for (final Account a : out.values()) {
r.add(new AccountInfo(a)); r.add(new AccountInfo(a));
} }

View File

@@ -200,8 +200,8 @@ public class AccountManager {
if (authConfig.isAllowGoogleAccountUpgrade() if (authConfig.isAllowGoogleAccountUpgrade()
&& who.isScheme(OpenIdUrls.URL_GOOGLE + "?") && who.isScheme(OpenIdUrls.URL_GOOGLE + "?")
&& who.getEmailAddress() != null) { && who.getEmailAddress() != null) {
final List<AccountExternalId> openId = new ArrayList<AccountExternalId>(); final List<AccountExternalId> openId = new ArrayList<>();
final List<AccountExternalId> v1 = new ArrayList<AccountExternalId>(); final List<AccountExternalId> v1 = new ArrayList<>();
for (final AccountExternalId extId : db.accountExternalIds() for (final AccountExternalId extId : db.accountExternalIds()
.byEmailAddress(who.getEmailAddress())) { .byEmailAddress(who.getEmailAddress())) {

View File

@@ -179,7 +179,7 @@ public class AccountResolver {
// At this point we have no clue. Just perform a whole bunch of suggestions // At this point we have no clue. Just perform a whole bunch of suggestions
// and pray we come up with a reasonable result list. // and pray we come up with a reasonable result list.
// //
Set<Account.Id> result = new HashSet<Account.Id>(); Set<Account.Id> result = new HashSet<>();
String a = nameOrEmail; String a = nameOrEmail;
String b = nameOrEmail + "\u9fa5"; String b = nameOrEmail + "\u9fa5";
for (Account act : schema.get().accounts().suggestByFullName(a, b, 10)) { for (Account act : schema.get().accounts().suggestByFullName(a, b, 10)) {

View File

@@ -74,7 +74,7 @@ public class AccountState {
* validated by Gerrit directly. * validated by Gerrit directly.
*/ */
public Set<String> getEmailAddresses() { public Set<String> getEmailAddresses() {
final Set<String> emails = new HashSet<String>(); final Set<String> emails = new HashSet<>();
for (final AccountExternalId e : externalIds) { for (final AccountExternalId e : externalIds) {
if (e.getEmailAddress() != null && !e.getEmailAddress().isEmpty()) { if (e.getEmailAddress() != null && !e.getEmailAddress().isEmpty()) {
emails.add(e.getEmailAddress()); emails.add(e.getEmailAddress());

View File

@@ -43,8 +43,7 @@ public class CapabilityCollection {
section = new AccessSection(AccessSection.GLOBAL_CAPABILITIES); section = new AccessSection(AccessSection.GLOBAL_CAPABILITIES);
} }
Map<String, List<PermissionRule>> tmp = Map<String, List<PermissionRule>> tmp = new HashMap<>();
new HashMap<String, List<PermissionRule>>();
for (Permission permission : section.getPermissions()) { for (Permission permission : section.getPermissions()) {
for (PermissionRule rule : permission.getRules()) { for (PermissionRule rule : permission.getRules()) {
if (!permission.getName().equals(GlobalCapability.EMAIL_REVIEWERS) if (!permission.getName().equals(GlobalCapability.EMAIL_REVIEWERS)
@@ -54,7 +53,7 @@ public class CapabilityCollection {
List<PermissionRule> r = tmp.get(permission.getName()); List<PermissionRule> r = tmp.get(permission.getName());
if (r == null) { if (r == null) {
r = new ArrayList<PermissionRule>(2); r = new ArrayList<>(2);
tmp.put(permission.getName(), r); tmp.put(permission.getName(), r);
} }
r.add(rule); r.add(rule);
@@ -62,8 +61,7 @@ public class CapabilityCollection {
} }
configureDefaults(tmp, section); configureDefaults(tmp, section);
Map<String, List<PermissionRule>> res = Map<String, List<PermissionRule>> res = new HashMap<>();
new HashMap<String, List<PermissionRule>>();
for (Map.Entry<String, List<PermissionRule>> e : tmp.entrySet()) { for (Map.Entry<String, List<PermissionRule>> e : tmp.entrySet()) {
List<PermissionRule> rules = e.getValue(); List<PermissionRule> rules = e.getValue();
if (rules.size() == 1) { if (rules.size() == 1) {

View File

@@ -54,7 +54,7 @@ public class CapabilityControl {
CapabilityControl(ProjectCache projectCache, @Assisted CurrentUser currentUser) { CapabilityControl(ProjectCache projectCache, @Assisted CurrentUser currentUser) {
capabilities = projectCache.getAllProjects().getCapabilityCollection(); capabilities = projectCache.getAllProjects().getCapabilityCollection();
user = currentUser; user = currentUser;
effective = new HashMap<String, List<PermissionRule>>(); effective = new HashMap<>();
} }
/** Identity of the user the control will compute for. */ /** Identity of the user the control will compute for. */
@@ -268,7 +268,7 @@ public class CapabilityControl {
return rules; return rules;
} }
List<PermissionRule> mine = new ArrayList<PermissionRule>(rules.size()); List<PermissionRule> mine = new ArrayList<>(rules.size());
for (PermissionRule rule : rules) { for (PermissionRule rule : rules) {
if (match(groups, rule)) { if (match(groups, rule)) {
mine.add(rule); mine.add(rule);

View File

@@ -141,7 +141,7 @@ public class ChangeUserName implements Callable<VoidResult> {
} }
private Collection<AccountExternalId> old() throws OrmException { private Collection<AccountExternalId> old() throws OrmException {
final Collection<AccountExternalId> r = new ArrayList<AccountExternalId>(1); final Collection<AccountExternalId> r = new ArrayList<>(1);
for (AccountExternalId i : db.accountExternalIds().byAccount( for (AccountExternalId i : db.accountExternalIds().byAccount(
user.getAccountId())) { user.getAccountId())) {
if (i.isScheme(SCHEME_USERNAME)) { if (i.isScheme(SCHEME_USERNAME)) {

View File

@@ -83,7 +83,7 @@ public class GroupDetailFactory implements Callable<GroupDetail> {
} }
private List<AccountGroupMember> loadMembers() throws OrmException { private List<AccountGroupMember> loadMembers() throws OrmException {
List<AccountGroupMember> members = new ArrayList<AccountGroupMember>(); List<AccountGroupMember> members = new ArrayList<>();
for (final AccountGroupMember m : db.accountGroupMembers().byGroup(groupId)) { for (final AccountGroupMember m : db.accountGroupMembers().byGroup(groupId)) {
if (control.canSeeMember(m.getAccountId())) { if (control.canSeeMember(m.getAccountId())) {
aic.want(m.getAccountId()); aic.want(m.getAccountId());
@@ -117,7 +117,7 @@ public class GroupDetailFactory implements Callable<GroupDetail> {
} }
private List<AccountGroupById> loadIncludes() throws OrmException { private List<AccountGroupById> loadIncludes() throws OrmException {
List<AccountGroupById> groups = new ArrayList<AccountGroupById>(); List<AccountGroupById> groups = new ArrayList<>();
for (final AccountGroupById m : db.accountGroupById().byGroup(groupId)) { for (final AccountGroupById m : db.accountGroupById().byGroup(groupId)) {
if (control.canSeeGroup(m.getIncludeUUID())) { if (control.canSeeGroup(m.getIncludeUUID())) {

View File

@@ -91,7 +91,7 @@ public class GroupMembers {
projectControl.controlFor(project, currentUser).getProjectState() projectControl.controlFor(project, currentUser).getProjectState()
.getOwners(); .getOwners();
final HashSet<Account> projectOwners = new HashSet<Account>(); final HashSet<Account> projectOwners = new HashSet<>();
for (final AccountGroup.UUID ownerGroup : ownerGroups) { for (final AccountGroup.UUID ownerGroup : ownerGroups) {
if (!seen.contains(ownerGroup)) { if (!seen.contains(ownerGroup)) {
projectOwners.addAll(listAccounts(ownerGroup, project, seen)); projectOwners.addAll(listAccounts(ownerGroup, project, seen));
@@ -107,7 +107,7 @@ public class GroupMembers {
final GroupDetail groupDetail = final GroupDetail groupDetail =
groupDetailFactory.create(group.getId()).call(); groupDetailFactory.create(group.getId()).call();
final Set<Account> members = new HashSet<Account>(); final Set<Account> members = new HashSet<>();
if (groupDetail.members != null) { if (groupDetail.members != null) {
for (final AccountGroupMember member : groupDetail.members) { for (final AccountGroupMember member : groupDetail.members) {
members.add(accountCache.get(member.getAccountId()).getAccount()); members.add(accountCache.get(member.getAccountId()).getAccount());

View File

@@ -126,10 +126,8 @@ public class PerformCreateGroup {
private void addMembers(final AccountGroup.Id groupId, private void addMembers(final AccountGroup.Id groupId,
final Collection<? extends Account.Id> members) throws OrmException { final Collection<? extends Account.Id> members) throws OrmException {
final List<AccountGroupMember> memberships = List<AccountGroupMember> memberships = new ArrayList<>();
new ArrayList<AccountGroupMember>(); List<AccountGroupMemberAudit> membershipsAudit = new ArrayList<>();
final List<AccountGroupMemberAudit> membershipsAudit =
new ArrayList<AccountGroupMemberAudit>();
for (Account.Id accountId : members) { for (Account.Id accountId : members) {
final AccountGroupMember membership = final AccountGroupMember membership =
new AccountGroupMember(new AccountGroupMember.Key(accountId, groupId)); new AccountGroupMember(new AccountGroupMember.Key(accountId, groupId));
@@ -149,10 +147,8 @@ public class PerformCreateGroup {
private void addGroups(final AccountGroup.Id groupId, private void addGroups(final AccountGroup.Id groupId,
final Collection<? extends AccountGroup.UUID> groups) throws OrmException { final Collection<? extends AccountGroup.UUID> groups) throws OrmException {
final List<AccountGroupById> includeList = List<AccountGroupById> includeList = new ArrayList<>();
new ArrayList<AccountGroupById>(); List<AccountGroupByIdAud> includesAudit = new ArrayList<>();
final List<AccountGroupByIdAud> includesAudit =
new ArrayList<AccountGroupByIdAud>();
for (AccountGroup.UUID includeUUID : groups) { for (AccountGroup.UUID includeUUID : groups) {
final AccountGroupById groupInclude = final AccountGroupById groupInclude =
new AccountGroupById(new AccountGroupById.Key(groupId, includeUUID)); new AccountGroupById(new AccountGroupById.Key(groupId, includeUUID));

View File

@@ -169,10 +169,10 @@ import javax.security.auth.login.LoginException;
LdapQuery.Result findAccount(final Helper.LdapSchema schema, LdapQuery.Result findAccount(final Helper.LdapSchema schema,
final DirContext ctx, final String username) throws NamingException, final DirContext ctx, final String username) throws NamingException,
AccountException { AccountException {
final HashMap<String, String> params = new HashMap<String, String>(); final HashMap<String, String> params = new HashMap<>();
params.put(LdapRealm.USERNAME, username); params.put(LdapRealm.USERNAME, username);
final List<LdapQuery.Result> res = new ArrayList<LdapQuery.Result>(); final List<LdapQuery.Result> res = new ArrayList<>();
for (LdapQuery accountQuery : schema.accountQueryList) { for (LdapQuery accountQuery : schema.accountQueryList) {
res.addAll(accountQuery.query(ctx, params)); res.addAll(accountQuery.query(ctx, params));
} }
@@ -193,10 +193,10 @@ import javax.security.auth.login.LoginException;
final String username, LdapQuery.Result account) final String username, LdapQuery.Result account)
throws NamingException, AccountException { throws NamingException, AccountException {
final LdapSchema schema = getSchema(ctx); final LdapSchema schema = getSchema(ctx);
final Set<String> groupDNs = new HashSet<String>(); final Set<String> groupDNs = new HashSet<>();
if (!schema.groupMemberQueryList.isEmpty()) { if (!schema.groupMemberQueryList.isEmpty()) {
final HashMap<String, String> params = new HashMap<String, String>(); final HashMap<String, String> params = new HashMap<>();
if (account == null) { if (account == null) {
try { try {
@@ -244,7 +244,7 @@ import javax.security.auth.login.LoginException;
} }
} }
final Set<AccountGroup.UUID> actual = new HashSet<AccountGroup.UUID>(); final Set<AccountGroup.UUID> actual = new HashSet<>();
for (String dn : groupDNs) { for (String dn : groupDNs) {
actual.add(new AccountGroup.UUID(LDAP_UUID + dn)); actual.add(new AccountGroup.UUID(LDAP_UUID + dn));
} }
@@ -305,10 +305,10 @@ import javax.security.auth.login.LoginException;
LdapSchema(final DirContext ctx) { LdapSchema(final DirContext ctx) {
type = discoverLdapType(ctx); type = discoverLdapType(ctx);
groupMemberQueryList = new ArrayList<LdapQuery>(); groupMemberQueryList = new ArrayList<>();
accountQueryList = new ArrayList<LdapQuery>(); accountQueryList = new ArrayList<>();
final Set<String> accountAtts = new HashSet<String>(); final Set<String> accountAtts = new HashSet<>();
// Group query // Group query
// //

View File

@@ -227,7 +227,7 @@ public class LdapGroupBackend implements GroupBackend {
ParameterizedString filter = ParameterizedString.asis( ParameterizedString filter = ParameterizedString.asis(
schema.groupPattern.replace(GROUPNAME, name).toString()); schema.groupPattern.replace(GROUPNAME, name).toString());
Set<String> returnAttrs = Set<String> returnAttrs =
new HashSet<String>(schema.groupName.getParameterNames()); new HashSet<>(schema.groupName.getParameterNames());
Map<String, String> params = Collections.emptyMap(); Map<String, String> params = Collections.emptyMap();
for (String groupBase : schema.groupBases) { for (String groupBase : schema.groupBases) {
LdapQuery query = new LdapQuery( LdapQuery query = new LdapQuery(

View File

@@ -69,7 +69,7 @@ class LdapQuery {
sc.setReturningAttributes(returnAttributes); sc.setReturningAttributes(returnAttributes);
res = ctx.search(base, pattern.getRawPattern(), pattern.bind(params), sc); res = ctx.search(base, pattern.getRawPattern(), pattern.bind(params), sc);
try { try {
final List<Result> r = new ArrayList<Result>(); final List<Result> r = new ArrayList<>();
try { try {
while (res.hasMore()) { while (res.hasMore()) {
r.add(new Result(res.next())); r.add(new Result(res.next()));
@@ -83,7 +83,7 @@ class LdapQuery {
} }
class Result { class Result {
private final Map<String, Attribute> atts = new HashMap<String, Attribute>(); private final Map<String, Attribute> atts = new HashMap<>();
Result(final SearchResult sr) { Result(final SearchResult sr) {
if (returnAttributes != null) { if (returnAttributes != null) {

View File

@@ -88,7 +88,7 @@ public class LdapRealm implements Realm {
this.membershipCache = membershipCache; this.membershipCache = membershipCache;
this.config = config; this.config = config;
this.readOnlyAccountFields = new HashSet<Account.FieldName>(); this.readOnlyAccountFields = new HashSet<>();
if (optdef(config, "accountFullName", "DEFAULT") != null) { if (optdef(config, "accountFullName", "DEFAULT") != null) {
readOnlyAccountFields.add(Account.FieldName.FULL_NAME); readOnlyAccountFields.add(Account.FieldName.FULL_NAME);
@@ -174,7 +174,7 @@ public class LdapRealm implements Realm {
return null; return null;
} }
final Map<String, String> values = new HashMap<String, String>(); final Map<String, String> values = new HashMap<>();
for (final String name : m.attributes()) { for (final String name : m.attributes()) {
values.put(name, m.get(name)); values.put(name, m.get(name));
} }

View File

@@ -83,8 +83,7 @@ public abstract class CacheModule extends AbstractModule {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Key<Cache<K, V>> key = (Key<Cache<K, V>>) Key.get(type, Names.named(name)); Key<Cache<K, V>> key = (Key<Cache<K, V>>) Key.get(type, Names.named(name));
CacheProvider<K, V> m = CacheProvider<K, V> m = new CacheProvider<>(this, name, keyType, valType);
new CacheProvider<K, V>(this, name, keyType, valType);
bind(key).toProvider(m).asEagerSingleton(); bind(key).toProvider(m).asEagerSingleton();
bind(ANY_CACHE).annotatedWith(Exports.named(name)).to(key); bind(ANY_CACHE).annotatedWith(Exports.named(name)).to(key);
return m.maximumWeight(1024); return m.maximumWeight(1024);

View File

@@ -441,8 +441,7 @@ public class ChangeJson {
private Map<String, LabelInfo> initLabels(ChangeData cd, private Map<String, LabelInfo> initLabels(ChangeData cd,
LabelTypes labelTypes, boolean standard) throws OrmException { LabelTypes labelTypes, boolean standard) throws OrmException {
// Don't use Maps.newTreeMap(Comparator) due to OpenJDK bug 100167. // Don't use Maps.newTreeMap(Comparator) due to OpenJDK bug 100167.
Map<String, LabelInfo> labels = Map<String, LabelInfo> labels = new TreeMap<>(labelTypes.nameComparator());
new TreeMap<String, LabelInfo>(labelTypes.nameComparator());
for (SubmitRecord rec : submitRecords(cd)) { for (SubmitRecord rec : submitRecords(cd)) {
if (rec.labels == null) { if (rec.labels == null) {
continue; continue;
@@ -572,8 +571,7 @@ public class ChangeJson {
// would have done. These should really come from a stored submit record. // would have done. These should really come from a stored submit record.
// //
// Don't use Maps.newTreeMap(Comparator) due to OpenJDK bug 100167. // Don't use Maps.newTreeMap(Comparator) due to OpenJDK bug 100167.
Map<String, LabelInfo> labels = Map<String, LabelInfo> labels = new TreeMap<>(labelTypes.nameComparator());
new TreeMap<String, LabelInfo>(labelTypes.nameComparator());
for (String name : labelNames) { for (String name : labelNames) {
LabelType type = labelTypes.byLabel(name); LabelType type = labelTypes.byLabel(name);
LabelInfo li = new LabelInfo(); LabelInfo li = new LabelInfo();

View File

@@ -90,7 +90,7 @@ public class ReviewerJson {
LabelTypes labelTypes = ctl.getLabelTypes(); LabelTypes labelTypes = ctl.getLabelTypes();
// Don't use Maps.newTreeMap(Comparator) due to OpenJDK bug 100167. // Don't use Maps.newTreeMap(Comparator) due to OpenJDK bug 100167.
out.approvals = new TreeMap<String,String>(labelTypes.nameComparator()); out.approvals = new TreeMap<>(labelTypes.nameComparator());
for (PatchSetApproval ca : approvals) { for (PatchSetApproval ca : approvals) {
for (PermissionRange pr : ctl.getLabelRanges()) { for (PermissionRange pr : ctl.getLabelRanges()) {
if (!pr.isEmpty()) { if (!pr.isEmpty()) {

View File

@@ -112,7 +112,7 @@ public class AuthConfig {
s = new String[] {"http://", "https://"}; s = new String[] {"http://", "https://"};
} }
List<OpenIdProviderPattern> r = new ArrayList<OpenIdProviderPattern>(); List<OpenIdProviderPattern> r = new ArrayList<>();
for (String pattern : s) { for (String pattern : s) {
r.add(OpenIdProviderPattern.create(pattern)); r.add(OpenIdProviderPattern.create(pattern));
} }

View File

@@ -165,7 +165,7 @@ public class ConfigUtil {
public static <T extends Enum<?>> List<T> getEnumList(final Config config, public static <T extends Enum<?>> List<T> getEnumList(final Config config,
final String section, final String subsection, final String setting, final String section, final String subsection, final String setting,
final T[] all, final T defaultValue) { final T[] all, final T defaultValue) {
final List<T> list = new ArrayList<T>(); final List<T> list = new ArrayList<>();
final String[] values = config.getStringList(section, subsection, setting); final String[] values = config.getStringList(section, subsection, setting);
if (values.length == 0) { if (values.length == 0) {
list.add(defaultValue); list.add(defaultValue);

View File

@@ -40,13 +40,13 @@ public class DownloadConfig {
ConfigUtil.getEnumList(cfg, "download", null, "scheme", ConfigUtil.getEnumList(cfg, "download", null, "scheme",
DownloadScheme.DEFAULT_DOWNLOADS); DownloadScheme.DEFAULT_DOWNLOADS);
downloadSchemes = downloadSchemes =
Collections.unmodifiableSet(new HashSet<DownloadScheme>(allSchemes)); Collections.unmodifiableSet(new HashSet<>(allSchemes));
List<DownloadCommand> allCommands = List<DownloadCommand> allCommands =
ConfigUtil.getEnumList(cfg, "download", null, "command", ConfigUtil.getEnumList(cfg, "download", null, "command",
DownloadCommand.DEFAULT_DOWNLOADS); DownloadCommand.DEFAULT_DOWNLOADS);
downloadCommands = downloadCommands =
Collections.unmodifiableSet(new HashSet<DownloadCommand>(allCommands)); Collections.unmodifiableSet(new HashSet<>(allCommands));
} }
/** Scheme used to download. */ /** Scheme used to download. */

View File

@@ -34,8 +34,7 @@ public class TrackingFootersProvider implements Provider<TrackingFooters> {
private static String FOOTER_TAG = "footer"; private static String FOOTER_TAG = "footer";
private static String SYSTEM_TAG = "system"; private static String SYSTEM_TAG = "system";
private static String REGEX_TAG = "match"; private static String REGEX_TAG = "match";
private final List<TrackingFooter> trackingFooters = private final List<TrackingFooter> trackingFooters = new ArrayList<>();
new ArrayList<TrackingFooter>();
private static final Logger log = private static final Logger log =
LoggerFactory.getLogger(TrackingFootersProvider.class); LoggerFactory.getLogger(TrackingFootersProvider.class);

View File

@@ -190,7 +190,7 @@ public class EventFactory {
*/ */
public void addSubmitRecords(ChangeAttribute ca, public void addSubmitRecords(ChangeAttribute ca,
List<SubmitRecord> submitRecords) { List<SubmitRecord> submitRecords) {
ca.submitRecords = new ArrayList<SubmitRecordAttribute>(); ca.submitRecords = new ArrayList<>();
for (SubmitRecord submitRecord : submitRecords) { for (SubmitRecord submitRecord : submitRecords) {
SubmitRecordAttribute sa = new SubmitRecordAttribute(); SubmitRecordAttribute sa = new SubmitRecordAttribute();
@@ -209,7 +209,7 @@ public class EventFactory {
private void addSubmitRecordLabels(SubmitRecord submitRecord, private void addSubmitRecordLabels(SubmitRecord submitRecord,
SubmitRecordAttribute sa) { SubmitRecordAttribute sa) {
if (submitRecord.labels != null && !submitRecord.labels.isEmpty()) { if (submitRecord.labels != null && !submitRecord.labels.isEmpty()) {
sa.labels = new ArrayList<SubmitLabelAttribute>(); sa.labels = new ArrayList<>();
for (SubmitRecord.Label lbl : submitRecord.labels) { for (SubmitRecord.Label lbl : submitRecord.labels) {
SubmitLabelAttribute la = new SubmitLabelAttribute(); SubmitLabelAttribute la = new SubmitLabelAttribute();
la.label = lbl.label; la.label = lbl.label;
@@ -224,8 +224,8 @@ public class EventFactory {
} }
public void addDependencies(ChangeAttribute ca, Change change) { public void addDependencies(ChangeAttribute ca, Change change) {
ca.dependsOn = new ArrayList<DependencyAttribute>(); ca.dependsOn = new ArrayList<>();
ca.neededBy = new ArrayList<DependencyAttribute>(); ca.neededBy = new ArrayList<>();
try { try {
final ReviewDb db = schema.open(); final ReviewDb db = schema.open();
try { try {
@@ -293,7 +293,7 @@ public class EventFactory {
public void addTrackingIds(ChangeAttribute a, Multimap<String, String> set) { public void addTrackingIds(ChangeAttribute a, Multimap<String, String> set) {
if (!set.isEmpty()) { if (!set.isEmpty()) {
a.trackingIds = new ArrayList<TrackingIdAttribute>(set.size()); a.trackingIds = new ArrayList<>(set.size());
for (Map.Entry<String, Collection<String>> e : set.asMap().entrySet()) { for (Map.Entry<String, Collection<String>> e : set.asMap().entrySet()) {
for (String id : e.getValue()) { for (String id : e.getValue()) {
TrackingIdAttribute t = new TrackingIdAttribute(); TrackingIdAttribute t = new TrackingIdAttribute();
@@ -324,7 +324,7 @@ public class EventFactory {
Map<PatchSet.Id, Collection<PatchSetApproval>> approvals, Map<PatchSet.Id, Collection<PatchSetApproval>> approvals,
boolean includeFiles, Change change, LabelTypes labelTypes) { boolean includeFiles, Change change, LabelTypes labelTypes) {
if (!ps.isEmpty()) { if (!ps.isEmpty()) {
ca.patchSets = new ArrayList<PatchSetAttribute>(ps.size()); ca.patchSets = new ArrayList<>(ps.size());
for (PatchSet p : ps) { for (PatchSet p : ps) {
PatchSetAttribute psa = asPatchSetAttribute(p); PatchSetAttribute psa = asPatchSetAttribute(p);
if (approvals != null) { if (approvals != null) {
@@ -344,8 +344,7 @@ public class EventFactory {
if (comment.getKey().getParentKey().getParentKey().get() if (comment.getKey().getParentKey().getParentKey().get()
== Integer.parseInt(patchSetAttribute.number)) { == Integer.parseInt(patchSetAttribute.number)) {
if (patchSetAttribute.comments == null) { if (patchSetAttribute.comments == null) {
patchSetAttribute.comments = patchSetAttribute.comments = new ArrayList<>();
new ArrayList<PatchSetCommentAttribute>();
} }
patchSetAttribute.comments.add(asPatchSetLineAttribute(comment)); patchSetAttribute.comments.add(asPatchSetLineAttribute(comment));
} }
@@ -358,7 +357,7 @@ public class EventFactory {
PatchList patchList = patchListCache.get(change, patchSet); PatchList patchList = patchListCache.get(change, patchSet);
for (PatchListEntry patch : patchList.getPatches()) { for (PatchListEntry patch : patchList.getPatches()) {
if (patchSetAttribute.files == null) { if (patchSetAttribute.files == null) {
patchSetAttribute.files = new ArrayList<PatchAttribute>(); patchSetAttribute.files = new ArrayList<>();
} }
PatchAttribute p = new PatchAttribute(); PatchAttribute p = new PatchAttribute();
@@ -376,7 +375,7 @@ public class EventFactory {
public void addComments(ChangeAttribute ca, public void addComments(ChangeAttribute ca,
Collection<ChangeMessage> messages) { Collection<ChangeMessage> messages) {
if (!messages.isEmpty()) { if (!messages.isEmpty()) {
ca.comments = new ArrayList<MessageAttribute>(); ca.comments = new ArrayList<>();
for (ChangeMessage message : messages) { for (ChangeMessage message : messages) {
ca.comments.add(asMessageAttribute(message)); ca.comments.add(asMessageAttribute(message));
} }
@@ -402,7 +401,7 @@ public class EventFactory {
try { try {
final ReviewDb db = schema.open(); final ReviewDb db = schema.open();
try { try {
p.parents = new ArrayList<String>(); p.parents = new ArrayList<>();
for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf( for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf(
patchSet.getId())) { patchSet.getId())) {
p.parents.add(a.getAncestorRevision().get()); p.parents.add(a.getAncestorRevision().get());
@@ -452,7 +451,7 @@ public class EventFactory {
public void addApprovals(PatchSetAttribute p, public void addApprovals(PatchSetAttribute p,
Collection<PatchSetApproval> list, LabelTypes labelTypes) { Collection<PatchSetApproval> list, LabelTypes labelTypes) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
p.approvals = new ArrayList<ApprovalAttribute>(list.size()); p.approvals = new ArrayList<>(list.size());
for (PatchSetApproval a : list) { for (PatchSetApproval a : list) {
if (a.getValue() != 0) { if (a.getValue() != 0) {
p.approvals.add(asApprovalAttribute(a, labelTypes)); p.approvals.add(asApprovalAttribute(a, labelTypes));

View File

@@ -24,7 +24,7 @@ public class AccountsSection {
public List<PermissionRule> getSameGroupVisibility() { public List<PermissionRule> getSameGroupVisibility() {
if (sameGroupVisibility == null) { if (sameGroupVisibility == null) {
sameGroupVisibility = new ArrayList<PermissionRule>(); sameGroupVisibility = new ArrayList<>();
} }
return sameGroupVisibility; return sameGroupVisibility;
} }

Some files were not shown because too many files have changed in this diff Show More