Remove unnecessary final modifiers
Change-Id: I32794046d557db051234b33d8b50d5d939bbbf1f
This commit is contained in:
committed by
David Pursehouse
parent
c8f90f1604
commit
eca086a537
@@ -68,12 +68,7 @@ abstract class ChunkManager {
|
||||
colorLines(cm, LineClassWhere.WRAP, color, line, line + cnt);
|
||||
}
|
||||
|
||||
void colorLines(
|
||||
final CodeMirror cm,
|
||||
final LineClassWhere where,
|
||||
final String className,
|
||||
final int start,
|
||||
final int end) {
|
||||
void colorLines(CodeMirror cm, LineClassWhere where, String className, int start, int end) {
|
||||
if (start < end) {
|
||||
for (int line = start; line < end; line++) {
|
||||
cm.addLineClass(line, where, className);
|
||||
|
||||
@@ -261,7 +261,7 @@ abstract class CommentManager {
|
||||
|
||||
abstract SortedMap<Integer, CommentGroup> getMapForNav(DisplaySide side);
|
||||
|
||||
Runnable commentNav(final CodeMirror src, final Direction dir) {
|
||||
Runnable commentNav(CodeMirror src, Direction dir) {
|
||||
return () -> {
|
||||
// Every comment appears in both side maps as a linked pair.
|
||||
// It is only necessary to search one side to find a comment
|
||||
|
||||
@@ -637,7 +637,7 @@ abstract class DiffScreen extends Screen {
|
||||
|
||||
abstract void setSyntaxHighlighting(boolean b);
|
||||
|
||||
void setContext(final int context) {
|
||||
void setContext(int context) {
|
||||
operation(
|
||||
() -> {
|
||||
skipManager.removeAll();
|
||||
|
||||
@@ -442,7 +442,7 @@ public class PreferencesBox extends Composite {
|
||||
|
||||
@UiHandler("mode")
|
||||
void onMode(@SuppressWarnings("unused") ChangeEvent e) {
|
||||
final String mode = getSelectedMode();
|
||||
String mode = getSelectedMode();
|
||||
prefs.syntaxHighlighting(true);
|
||||
syntaxHighlighting.setValue(true, false);
|
||||
new ModeInjector()
|
||||
@@ -525,7 +525,7 @@ public class PreferencesBox extends Composite {
|
||||
|
||||
@UiHandler("theme")
|
||||
void onTheme(@SuppressWarnings("unused") ChangeEvent e) {
|
||||
final Theme newTheme = getSelectedTheme();
|
||||
Theme newTheme = getSelectedTheme();
|
||||
prefs.theme(newTheme);
|
||||
if (view != null) {
|
||||
ThemeLoader.loadTheme(
|
||||
|
||||
@@ -180,8 +180,8 @@ public class SideBySide extends DiffScreen {
|
||||
};
|
||||
}
|
||||
|
||||
private void display(final CommentsCollections comments) {
|
||||
final DiffInfo diff = getDiff();
|
||||
private void display(CommentsCollections comments) {
|
||||
DiffInfo diff = getDiff();
|
||||
setThemeStyles(prefs.theme().isDark());
|
||||
setShowIntraline(prefs.intralineDifference());
|
||||
if (prefs.showLineNumbers()) {
|
||||
@@ -313,8 +313,8 @@ public class SideBySide extends DiffScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
Runnable updateActiveLine(final CodeMirror cm) {
|
||||
final CodeMirror other = otherCm(cm);
|
||||
Runnable updateActiveLine(CodeMirror cm) {
|
||||
CodeMirror other = otherCm(cm);
|
||||
return () -> {
|
||||
// The rendering of active lines has to be deferred. Reflow
|
||||
// caused by adding and removing styles chokes Firefox when arrow
|
||||
@@ -345,13 +345,13 @@ public class SideBySide extends DiffScreen {
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable moveCursorToSide(final CodeMirror cmSrc, DisplaySide sideDst) {
|
||||
final CodeMirror cmDst = getCmFromSide(sideDst);
|
||||
private Runnable moveCursorToSide(CodeMirror cmSrc, DisplaySide sideDst) {
|
||||
CodeMirror cmDst = getCmFromSide(sideDst);
|
||||
if (cmDst == cmSrc) {
|
||||
return () -> {};
|
||||
}
|
||||
|
||||
final DisplaySide sideSrc = cmSrc.side();
|
||||
DisplaySide sideSrc = cmSrc.side();
|
||||
return () -> {
|
||||
if (cmSrc.extras().hasActiveLine()) {
|
||||
cmDst.setCursor(
|
||||
|
||||
@@ -245,7 +245,7 @@ class SideBySideChunkManager extends ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
Runnable diffChunkNav(final CodeMirror cm, final Direction dir) {
|
||||
Runnable diffChunkNav(CodeMirror cm, Direction dir) {
|
||||
return () -> {
|
||||
int line = cm.extras().hasActiveLine() ? cm.getLineNumber(cm.extras().activeLine()) : 0;
|
||||
int res =
|
||||
|
||||
@@ -133,7 +133,7 @@ public class Unified extends DiffScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
void registerCmEvents(final CodeMirror cm) {
|
||||
void registerCmEvents(CodeMirror cm) {
|
||||
super.registerCmEvents(cm);
|
||||
|
||||
cm.on(
|
||||
@@ -164,8 +164,8 @@ public class Unified extends DiffScreen {
|
||||
};
|
||||
}
|
||||
|
||||
private void display(final CommentsCollections comments) {
|
||||
final DiffInfo diff = getDiff();
|
||||
private void display(CommentsCollections comments) {
|
||||
DiffInfo diff = getDiff();
|
||||
setThemeStyles(prefs.theme().isDark());
|
||||
setShowIntraline(prefs.intralineDifference());
|
||||
if (prefs.showLineNumbers()) {
|
||||
@@ -307,7 +307,7 @@ public class Unified extends DiffScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
Runnable updateActiveLine(final CodeMirror cm) {
|
||||
Runnable updateActiveLine(CodeMirror cm) {
|
||||
return () -> {
|
||||
// The rendering of active lines has to be deferred. Reflow
|
||||
// caused by adding and removing styles chokes Firefox when arrow
|
||||
|
||||
@@ -213,7 +213,7 @@ class UnifiedChunkManager extends ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
Runnable diffChunkNav(final CodeMirror cm, final Direction dir) {
|
||||
Runnable diffChunkNav(CodeMirror cm, Direction dir) {
|
||||
return () -> {
|
||||
int line = cm.extras().hasActiveLine() ? cm.getLineNumber(cm.extras().activeLine()) : 0;
|
||||
int res =
|
||||
|
||||
@@ -468,7 +468,7 @@ public class EditScreen extends Screen {
|
||||
cmEdit.setOption(option, value);
|
||||
}
|
||||
|
||||
void setTheme(final Theme newTheme) {
|
||||
void setTheme(Theme newTheme) {
|
||||
cmBase.operation(
|
||||
() -> {
|
||||
cmBase.setOption("theme", newTheme.name().toLowerCase());
|
||||
@@ -494,7 +494,7 @@ public class EditScreen extends Screen {
|
||||
cmEdit.setOption("lineNumbers", show);
|
||||
}
|
||||
|
||||
void setShowWhitespaceErrors(final boolean show) {
|
||||
void setShowWhitespaceErrors(boolean show) {
|
||||
cmBase.operation(
|
||||
() -> {
|
||||
cmBase.setOption("showTrailingSpace", show);
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class AbstractLuceneIndex<K, V> implements Index<K, V> {
|
||||
this.sitePaths = sitePaths;
|
||||
this.dir = dir;
|
||||
this.name = name;
|
||||
final String index = Joiner.on('_').skipNulls().join(name, subIndex);
|
||||
String index = Joiner.on('_').skipNulls().join(name, subIndex);
|
||||
IndexWriter delegateWriter;
|
||||
long commitPeriod = writerConfig.getCommitWithinMs();
|
||||
|
||||
@@ -243,15 +243,15 @@ public abstract class AbstractLuceneIndex<K, V> implements Index<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
ListenableFuture<?> insert(final Document doc) {
|
||||
ListenableFuture<?> insert(Document doc) {
|
||||
return submit(() -> writer.addDocument(doc));
|
||||
}
|
||||
|
||||
ListenableFuture<?> replace(final Term term, final Document doc) {
|
||||
ListenableFuture<?> replace(Term term, Document doc) {
|
||||
return submit(() -> writer.updateDocument(term, doc));
|
||||
}
|
||||
|
||||
ListenableFuture<?> delete(final Term term) {
|
||||
ListenableFuture<?> delete(Term term) {
|
||||
return submit(() -> writer.deleteDocuments(term));
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public class RebuildNoteDb extends SiteProgram {
|
||||
List<ListenableFuture<Boolean>> futures = new ArrayList<>();
|
||||
List<Project.NameKey> projectNames =
|
||||
Ordering.usingToString().sortedCopy(changesByProject.keySet());
|
||||
for (final Project.NameKey project : projectNames) {
|
||||
for (Project.NameKey project : projectNames) {
|
||||
ListenableFuture<Boolean> future =
|
||||
executor.submit(
|
||||
() -> {
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
}
|
||||
|
||||
private void procJvmMemory(MetricMaker metrics) {
|
||||
final CallbackMetric0<Long> heapCommitted =
|
||||
CallbackMetric0<Long> heapCommitted =
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/memory/heap_committed",
|
||||
Long.class,
|
||||
@@ -111,7 +111,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
.setGauge()
|
||||
.setUnit(Units.BYTES));
|
||||
|
||||
final CallbackMetric0<Long> heapUsed =
|
||||
CallbackMetric0<Long> heapUsed =
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/memory/heap_used",
|
||||
Long.class,
|
||||
@@ -119,7 +119,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
.setGauge()
|
||||
.setUnit(Units.BYTES));
|
||||
|
||||
final CallbackMetric0<Long> nonHeapCommitted =
|
||||
CallbackMetric0<Long> nonHeapCommitted =
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/memory/non_heap_committed",
|
||||
Long.class,
|
||||
@@ -127,7 +127,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
.setGauge()
|
||||
.setUnit(Units.BYTES));
|
||||
|
||||
final CallbackMetric0<Long> nonHeapUsed =
|
||||
CallbackMetric0<Long> nonHeapUsed =
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/memory/non_heap_used",
|
||||
Long.class,
|
||||
@@ -135,7 +135,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
.setGauge()
|
||||
.setUnit(Units.BYTES));
|
||||
|
||||
final CallbackMetric0<Integer> objectPendingFinalizationCount =
|
||||
CallbackMetric0<Integer> objectPendingFinalizationCount =
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/memory/object_pending_finalization_count",
|
||||
Integer.class,
|
||||
@@ -143,7 +143,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
.setGauge()
|
||||
.setUnit("objects"));
|
||||
|
||||
final MemoryMXBean memory = ManagementFactory.getMemoryMXBean();
|
||||
MemoryMXBean memory = ManagementFactory.getMemoryMXBean();
|
||||
metrics.newTrigger(
|
||||
ImmutableSet.<CallbackMetric<?>>of(
|
||||
heapCommitted, heapUsed, nonHeapCommitted, nonHeapUsed, objectPendingFinalizationCount),
|
||||
@@ -165,14 +165,14 @@ public class ProcMetricModule extends MetricModule {
|
||||
}
|
||||
|
||||
private void procJvmGc(MetricMaker metrics) {
|
||||
final CallbackMetric1<String, Long> gcCount =
|
||||
CallbackMetric1<String, Long> gcCount =
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/gc/count",
|
||||
Long.class,
|
||||
new Description("Number of GCs").setCumulative(),
|
||||
Field.ofString("gc_name", "The name of the garbage collector"));
|
||||
|
||||
final CallbackMetric1<String, Long> gcTime =
|
||||
CallbackMetric1<String, Long> gcTime =
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/gc/time",
|
||||
Long.class,
|
||||
@@ -199,16 +199,11 @@ public class ProcMetricModule extends MetricModule {
|
||||
}
|
||||
|
||||
private void procJvmThread(MetricMaker metrics) {
|
||||
final ThreadMXBean thread = ManagementFactory.getThreadMXBean();
|
||||
ThreadMXBean thread = ManagementFactory.getThreadMXBean();
|
||||
metrics.newCallbackMetric(
|
||||
"proc/jvm/thread/num_live",
|
||||
Integer.class,
|
||||
new Description("Current live thread count").setGauge().setUnit("threads"),
|
||||
new Supplier<Integer>() {
|
||||
@Override
|
||||
public Integer get() {
|
||||
return thread.getThreadCount();
|
||||
}
|
||||
});
|
||||
() -> thread.getThreadCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,41 +30,41 @@ import java.util.Set;
|
||||
@Singleton
|
||||
public class CacheMetrics {
|
||||
@Inject
|
||||
public CacheMetrics(MetricMaker metrics, final DynamicMap<Cache<?, ?>> cacheMap) {
|
||||
public CacheMetrics(MetricMaker metrics, DynamicMap<Cache<?, ?>> cacheMap) {
|
||||
Field<String> F_NAME = Field.ofString("cache_name");
|
||||
|
||||
final CallbackMetric1<String, Long> memEnt =
|
||||
CallbackMetric1<String, Long> memEnt =
|
||||
metrics.newCallbackMetric(
|
||||
"caches/memory_cached",
|
||||
Long.class,
|
||||
new Description("Memory entries").setGauge().setUnit("entries"),
|
||||
F_NAME);
|
||||
final CallbackMetric1<String, Double> memHit =
|
||||
CallbackMetric1<String, Double> memHit =
|
||||
metrics.newCallbackMetric(
|
||||
"caches/memory_hit_ratio",
|
||||
Double.class,
|
||||
new Description("Memory hit ratio").setGauge().setUnit("percent"),
|
||||
F_NAME);
|
||||
final CallbackMetric1<String, Long> memEvict =
|
||||
CallbackMetric1<String, Long> memEvict =
|
||||
metrics.newCallbackMetric(
|
||||
"caches/memory_eviction_count",
|
||||
Long.class,
|
||||
new Description("Memory eviction count").setGauge().setUnit("evicted entries"),
|
||||
F_NAME);
|
||||
final CallbackMetric1<String, Long> perDiskEnt =
|
||||
CallbackMetric1<String, Long> perDiskEnt =
|
||||
metrics.newCallbackMetric(
|
||||
"caches/disk_cached",
|
||||
Long.class,
|
||||
new Description("Disk entries used by persistent cache").setGauge().setUnit("entries"),
|
||||
F_NAME);
|
||||
final CallbackMetric1<String, Double> perDiskHit =
|
||||
CallbackMetric1<String, Double> perDiskHit =
|
||||
metrics.newCallbackMetric(
|
||||
"caches/disk_hit_ratio",
|
||||
Double.class,
|
||||
new Description("Disk hit ratio for persistent cache").setGauge().setUnit("percent"),
|
||||
F_NAME);
|
||||
|
||||
final Set<CallbackMetric<?>> cacheMetrics =
|
||||
Set<CallbackMetric<?>> cacheMetrics =
|
||||
ImmutableSet.<CallbackMetric<?>>of(memEnt, memHit, memEvict, perDiskEnt, perDiskHit);
|
||||
|
||||
metrics.newTrigger(
|
||||
@@ -83,9 +83,7 @@ public class CacheMetrics {
|
||||
perDiskHit.set(name, hitRatio(d));
|
||||
}
|
||||
}
|
||||
for (CallbackMetric<?> cbm : cacheMetrics) {
|
||||
cbm.prune();
|
||||
}
|
||||
cacheMetrics.forEach(CallbackMetric::prune);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class RequestScopedReviewDbProvider implements Provider<ReviewDb> {
|
||||
@Override
|
||||
public ReviewDb get() {
|
||||
if (db == null) {
|
||||
final ReviewDb c;
|
||||
ReviewDb c;
|
||||
try {
|
||||
c = schema.open();
|
||||
} catch (OrmException e) {
|
||||
|
||||
@@ -82,7 +82,7 @@ public class AllAccountsIndexer extends SiteIndexer<Account.Id, AccountState, Ac
|
||||
AtomicInteger done = new AtomicInteger();
|
||||
AtomicInteger failed = new AtomicInteger();
|
||||
Stopwatch sw = Stopwatch.createStarted();
|
||||
for (final Account.Id id : ids) {
|
||||
for (Account.Id id : ids) {
|
||||
String desc = "account " + id;
|
||||
ListenableFuture<?> future =
|
||||
executor.submit(
|
||||
|
||||
@@ -81,7 +81,7 @@ public class AllGroupsIndexer extends SiteIndexer<AccountGroup.UUID, AccountGrou
|
||||
AtomicInteger done = new AtomicInteger();
|
||||
AtomicInteger failed = new AtomicInteger();
|
||||
Stopwatch sw = Stopwatch.createStarted();
|
||||
for (final AccountGroup.UUID uuid : uuids) {
|
||||
for (AccountGroup.UUID uuid : uuids) {
|
||||
String desc = "group " + uuid;
|
||||
ListenableFuture<?> future =
|
||||
executor.submit(
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class ChangeRebuilder {
|
||||
}
|
||||
|
||||
public final ListenableFuture<Result> rebuildAsync(
|
||||
final Change.Id id, ListeningExecutorService executor) {
|
||||
Change.Id id, ListeningExecutorService executor) {
|
||||
return executor.submit(
|
||||
() -> {
|
||||
try (ReviewDb db = schemaFactory.open()) {
|
||||
|
||||
@@ -250,8 +250,7 @@ public class PatchListLoader implements Callable<PatchList> {
|
||||
}
|
||||
|
||||
private FileHeader toFileHeader(
|
||||
PatchListKey key, final DiffFormatter diffFormatter, final DiffEntry diffEntry)
|
||||
throws IOException {
|
||||
PatchListKey key, DiffFormatter diffFormatter, DiffEntry diffEntry) throws IOException {
|
||||
|
||||
Future<FileHeader> result =
|
||||
diffExecutor.submit(
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ProjectCacheWarmer implements LifecycleListener {
|
||||
public void start() {
|
||||
int cpus = Runtime.getRuntime().availableProcessors();
|
||||
if (config.getBoolean("cache", "projects", "loadOnStartup", false)) {
|
||||
final ThreadPoolExecutor pool =
|
||||
ThreadPoolExecutor pool =
|
||||
new ScheduledThreadPoolExecutor(
|
||||
config.getInt("cache", "projects", "loadThreads", cpus),
|
||||
new ThreadFactoryBuilder().setNameFormat("ProjectCacheLoader-%d").build());
|
||||
|
||||
@@ -172,7 +172,7 @@ public abstract class RequestScopePropagator {
|
||||
/** @see #wrap(Callable) */
|
||||
protected abstract <T> Callable<T> wrapImpl(Callable<T> callable);
|
||||
|
||||
protected <T> Callable<T> context(final RequestContext context, final Callable<T> callable) {
|
||||
protected <T> Callable<T> context(RequestContext context, Callable<T> callable) {
|
||||
return () -> {
|
||||
RequestContext old =
|
||||
local.setContext(
|
||||
@@ -195,7 +195,7 @@ public abstract class RequestScopePropagator {
|
||||
};
|
||||
}
|
||||
|
||||
protected <T> Callable<T> cleanup(final Callable<T> callable) {
|
||||
protected <T> Callable<T> cleanup(Callable<T> callable) {
|
||||
return () -> {
|
||||
RequestCleanup cleanup =
|
||||
scope
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class ThreadLocalRequestScopePropagator<C> extends RequestScopeP
|
||||
|
||||
/** @see RequestScopePropagator#wrap(Callable) */
|
||||
@Override
|
||||
protected final <T> Callable<T> wrapImpl(final Callable<T> callable) {
|
||||
protected final <T> Callable<T> wrapImpl(Callable<T> callable) {
|
||||
C ctx = continuingContext(requireContext());
|
||||
return () -> {
|
||||
C old = threadLocal.get();
|
||||
|
||||
@@ -126,11 +126,11 @@ public class ProcMetricModuleTest {
|
||||
|
||||
@Test
|
||||
public void callbackMetric0() {
|
||||
final CallbackMetric0<Long> cntr =
|
||||
CallbackMetric0<Long> cntr =
|
||||
metrics.newCallbackMetric(
|
||||
"test/count", Long.class, new Description("simple test").setCumulative());
|
||||
|
||||
final AtomicInteger invocations = new AtomicInteger(0);
|
||||
AtomicInteger invocations = new AtomicInteger(0);
|
||||
metrics.newTrigger(
|
||||
cntr,
|
||||
() -> {
|
||||
|
||||
Reference in New Issue
Block a user