Skip to content

Commit

Permalink
touchups
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Apr 19, 2022
1 parent 2649ac9 commit d6cb05b
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ public int size() {
@Override
@SuppressWarnings("PMD.AvoidReassigningLoopVariables")
public void clear() {
for (E e = first; e != null;) {
E e = first;
while (e != null) {
E next = getNext(e);
setPrevious(e, null);
setNext(e, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3743,7 +3743,7 @@ static final class BoundedPolicy<K, V> implements Policy<K, V> {
var refreshes = cache.refreshes;
if ((refreshes == null) || refreshes.isEmpty()) {
return Map.of();
} if (cache.collectKeys()) {
} else if (cache.collectKeys()) {
var inFlight = new IdentityHashMap<K, CompletableFuture<V>>(refreshes.size());
for (var entry : refreshes.entrySet()) {
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ abstract class BaseMpscLinkedArrayQueue<E> extends BaseMpscLinkedArrayQueueColdP

// No post padding here, subclasses must add

private final static Object JUMP = new Object();
private static final Object JUMP = new Object();

/**
* @param initialCapacity the queue initial capacity. If chunk size is fixed this will be the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.UnaryOperator;

import com.github.benmanes.caffeine.cache.simulator.policy.PolicyStats;
import com.typesafe.config.Config;
Expand All @@ -28,13 +29,13 @@
*/
@SuppressWarnings("ImmutableEnumChecker")
public enum Admission {
ALWAYS((config, policyStats) -> Admittor.always(), Function.identity()),
ALWAYS((config, policyStats) -> Admittor.always(), UnaryOperator.identity()),
TINYLFU(TinyLfu::new, name -> name + "_TinyLfu");

private final BiFunction<Config, PolicyStats, Admittor> factory;
private final Function<String, String> formatter;

Admission(BiFunction<Config, PolicyStats, Admittor> factory, Function<String, String> formatter) {
Admission(BiFunction<Config, PolicyStats, Admittor> factory, UnaryOperator<String> formatter) {
this.formatter = formatter;
this.factory = factory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
import java.util.function.UnaryOperator;

import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
Expand Down Expand Up @@ -69,7 +69,7 @@ protected BufferedInputStream readInput(InputStream input) {
BufferedInputStream buffered = null;
try {
buffered = new BufferedInputStream(input, BUFFER_SIZE);
List<Function<InputStream, InputStream>> extractors = List.of(
List<UnaryOperator<InputStream>> extractors = List.of(
this::tryXZ, this::tryCompressed, this::tryArchived);
for (var extractor : extractors) {
buffered.mark(100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public boolean isAllowed(String path) {
}

@AutoValue
static abstract class Replacement {
abstract static class Replacement {
abstract String search();
abstract String replace();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ static final class LongSerializer implements CacheSerializer<Long> {
@Override public int serializedSize(Long value) {
return Long.BYTES;
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void run() {

/** Normalizes the input parameters. */
private void normalize() {
metric = metric.replaceAll("_", " ");
metric = metric.replace('_', ' ');
inputFiles = new TreeMap<>(inputFiles);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static void main(String[] args) {
}

@AutoValue @AutoBuilder
static abstract class ChartStyle {
abstract static class ChartStyle {
abstract RectangleInsets axisOffset();

abstract Color title();
Expand Down

0 comments on commit d6cb05b

Please sign in to comment.