Format all Java files with google-java-format
Having a standard tool for formatting saves reviewers' valuable time. google-java-format is Google's standard formatter and is somewhat inspired by gofmt[1]. This commit formats everything using google-java-format version 1.2. The downside of this one-off formatting is breaking blame. This can be somewhat hacked around with a tool like git-hyper-blame[2], but it's definitely not optimal until/unless this kind of feature makes its way to git core. Not in this change: * Tool support, e.g. Eclipse. The command must be run manually [3]. * Documentation of best practice, e.g. new 100-column default. [1] https://talks.golang.org/2015/gofmt-en.slide#3 [2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html [3] git ls-files | grep java$ | xargs google-java-format -i Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3 Signed-off-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
committed by
David Pursehouse
parent
6723b6d0fa
commit
292fa154c1
@@ -17,7 +17,6 @@ package com.google.gerrit.metrics;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gerrit.extensions.registration.RegistrationHandle;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/** Factory to create metrics for monitoring. */
|
||||
@@ -30,15 +29,14 @@ public abstract class MetricMaker {
|
||||
* @return counter
|
||||
*/
|
||||
public abstract Counter0 newCounter(String name, Description desc);
|
||||
public abstract <F1> Counter1<F1> newCounter(
|
||||
String name, Description desc,
|
||||
Field<F1> field1);
|
||||
|
||||
public abstract <F1> Counter1<F1> newCounter(String name, Description desc, Field<F1> field1);
|
||||
|
||||
public abstract <F1, F2> Counter2<F1, F2> newCounter(
|
||||
String name, Description desc,
|
||||
Field<F1> field1, Field<F2> field2);
|
||||
String name, Description desc, Field<F1> field1, Field<F2> field2);
|
||||
|
||||
public abstract <F1, F2, F3> Counter3<F1, F2, F3> newCounter(
|
||||
String name, Description desc,
|
||||
Field<F1> field1, Field<F2> field2, Field<F3> field3);
|
||||
String name, Description desc, Field<F1> field1, Field<F2> field2, Field<F3> field3);
|
||||
|
||||
/**
|
||||
* Metric recording time spent on an operation.
|
||||
@@ -48,15 +46,14 @@ public abstract class MetricMaker {
|
||||
* @return timer
|
||||
*/
|
||||
public abstract Timer0 newTimer(String name, Description desc);
|
||||
public abstract <F1> Timer1<F1> newTimer(
|
||||
String name, Description desc,
|
||||
Field<F1> field1);
|
||||
|
||||
public abstract <F1> Timer1<F1> newTimer(String name, Description desc, Field<F1> field1);
|
||||
|
||||
public abstract <F1, F2> Timer2<F1, F2> newTimer(
|
||||
String name, Description desc,
|
||||
Field<F1> field1, Field<F2> field2);
|
||||
String name, Description desc, Field<F1> field1, Field<F2> field2);
|
||||
|
||||
public abstract <F1, F2, F3> Timer3<F1, F2, F3> newTimer(
|
||||
String name, Description desc,
|
||||
Field<F1> field1, Field<F2> field2, Field<F3> field3);
|
||||
String name, Description desc, Field<F1> field1, Field<F2> field2, Field<F3> field3);
|
||||
|
||||
/**
|
||||
* Metric recording statistical distribution of values.
|
||||
@@ -66,15 +63,14 @@ public abstract class MetricMaker {
|
||||
* @return histogram
|
||||
*/
|
||||
public abstract Histogram0 newHistogram(String name, Description desc);
|
||||
public abstract <F1> Histogram1<F1> newHistogram(
|
||||
String name, Description desc,
|
||||
Field<F1> field1);
|
||||
|
||||
public abstract <F1> Histogram1<F1> newHistogram(String name, Description desc, Field<F1> field1);
|
||||
|
||||
public abstract <F1, F2> Histogram2<F1, F2> newHistogram(
|
||||
String name, Description desc,
|
||||
Field<F1> field1, Field<F2> field2);
|
||||
String name, Description desc, Field<F1> field1, Field<F2> field2);
|
||||
|
||||
public abstract <F1, F2, F3> Histogram3<F1, F2, F3> newHistogram(
|
||||
String name, Description desc,
|
||||
Field<F1> field1, Field<F2> field2, Field<F3> field3);
|
||||
String name, Description desc, Field<F1> field1, Field<F2> field2, Field<F3> field3);
|
||||
|
||||
/**
|
||||
* Constant value that does not change.
|
||||
@@ -89,12 +85,14 @@ public abstract class MetricMaker {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<V> type = (Class<V>) value.getClass();
|
||||
final CallbackMetric0<V> metric = newCallbackMetric(name, type, desc);
|
||||
newTrigger(metric, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
metric.set(value);
|
||||
}
|
||||
});
|
||||
newTrigger(
|
||||
metric,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
metric.set(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,19 +115,21 @@ public abstract class MetricMaker {
|
||||
* @param desc description of the metric.
|
||||
* @param trigger function to compute the value of the metric.
|
||||
*/
|
||||
public <V> void newCallbackMetric(String name,
|
||||
Class<V> valueClass, Description desc, final Supplier<V> trigger) {
|
||||
public <V> void newCallbackMetric(
|
||||
String name, Class<V> valueClass, Description desc, final Supplier<V> trigger) {
|
||||
final CallbackMetric0<V> metric = newCallbackMetric(name, valueClass, desc);
|
||||
newTrigger(metric, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
metric.set(trigger.get());
|
||||
}
|
||||
});
|
||||
newTrigger(
|
||||
metric,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
metric.set(trigger.get());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantaneous reading of a single value.
|
||||
* Instantaneous reading of a single value.
|
||||
*
|
||||
* @param name field name
|
||||
* @param valueClass field type
|
||||
@@ -138,9 +138,9 @@ public abstract class MetricMaker {
|
||||
*/
|
||||
public abstract <V> CallbackMetric0<V> newCallbackMetric(
|
||||
String name, Class<V> valueClass, Description desc);
|
||||
|
||||
public abstract <F1, V> CallbackMetric1<F1, V> newCallbackMetric(
|
||||
String name, Class<V> valueClass, Description desc,
|
||||
Field<F1> field1);
|
||||
String name, Class<V> valueClass, Description desc, Field<F1> field1);
|
||||
|
||||
/**
|
||||
* Connect logic to populate a previously created {@link CallbackMetric}.
|
||||
@@ -153,16 +153,18 @@ public abstract class MetricMaker {
|
||||
return newTrigger(ImmutableSet.<CallbackMetric<?>>of(metric1), trigger);
|
||||
}
|
||||
|
||||
public RegistrationHandle newTrigger(CallbackMetric<?> metric1,
|
||||
CallbackMetric<?> metric2, Runnable trigger) {
|
||||
public RegistrationHandle newTrigger(
|
||||
CallbackMetric<?> metric1, CallbackMetric<?> metric2, Runnable trigger) {
|
||||
return newTrigger(ImmutableSet.of(metric1, metric2), trigger);
|
||||
}
|
||||
|
||||
public RegistrationHandle newTrigger(CallbackMetric<?> metric1,
|
||||
CallbackMetric<?> metric2, CallbackMetric<?> metric3, Runnable trigger) {
|
||||
public RegistrationHandle newTrigger(
|
||||
CallbackMetric<?> metric1,
|
||||
CallbackMetric<?> metric2,
|
||||
CallbackMetric<?> metric3,
|
||||
Runnable trigger) {
|
||||
return newTrigger(ImmutableSet.of(metric1, metric2, metric3), trigger);
|
||||
}
|
||||
|
||||
public abstract RegistrationHandle newTrigger(Set<CallbackMetric<?>> metrics,
|
||||
Runnable trigger);
|
||||
public abstract RegistrationHandle newTrigger(Set<CallbackMetric<?>> metrics, Runnable trigger);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user