Skip to content

Commit

Permalink
fix lines of code that unnecessarily exceed 100c limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Dec 16, 2022
1 parent d989dc5 commit 412e0d0
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ public void maximumSize_decrease_negative(Cache<Int, Int> cache,
}

@Test(dataProvider = "caches")
@CacheSpec(maximumSize = Maximum.FULL, removalListener = { Listener.DISABLED, Listener.REJECTING })
@CacheSpec(maximumSize = Maximum.FULL, removalListener = {Listener.DISABLED, Listener.REJECTING})
public void maximumSize_increase(Cache<Int, Int> cache,
CacheContext context, Eviction<Int, Int> eviction) {
eviction.setMaximum(2 * context.maximumWeightOrSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,8 @@ public void compute_error(Cache<Int, Int> cache,
}

@Test(dataProvider = "caches")
@CacheSpec(expiry = CacheExpiry.MOCKITO, removalListener = {Listener.DISABLED, Listener.REJECTING})
@CacheSpec(expiry = CacheExpiry.MOCKITO,
removalListener = {Listener.DISABLED, Listener.REJECTING})
public void compute_absent_nullValue(Cache<Int, Int> cache,
CacheContext context, VarExpiration<Int, Int> expireAfterVar) {
Int result = expireAfterVar.compute(context.absentKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,8 @@ public void refresh_absent_null(LoadingCache<Int, Int> cache, CacheContext conte

@CheckNoEvictions
@Test(dataProvider = "caches")
@CacheSpec(
maximumSize = Maximum.UNREACHABLE,
removalListener = { Listener.DISABLED, Listener.REJECTING }, population = Population.SINGLETON)
@CacheSpec(population = Population.SINGLETON, maximumSize = Maximum.UNREACHABLE,
removalListener = { Listener.DISABLED, Listener.REJECTING })
public void refresh_absent(LoadingCache<Int, Int> cache, CacheContext context) {
Int key = context.absentKey();
var future = cache.refresh(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ private void checkEvictionDeque(BoundedLocalCache<Object, Object> bounded) {
var deques = new ImmutableTable.Builder<String, Long, LinkedDeque<Node<Object, Object>>>()
.put("window", bounded.windowWeightedSize(), bounded.accessOrderWindowDeque())
.put("probation", mainProbation, bounded.accessOrderProbationDeque())
.put("protected", bounded.mainProtectedWeightedSize(), bounded.accessOrderProtectedDeque())
.put("protected", bounded.mainProtectedWeightedSize(),
bounded.accessOrderProtectedDeque())
.build();
checkLinks(bounded, deques);
check("accessOrderWindowDeque()").about(deque())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ private void checkBoundedLocalCache(
checkEvictionListener(original, copy);
}

private void checkRefreshAfterWrite(BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
private void checkRefreshAfterWrite(
BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
check("refreshAfterWrite()").that(copy.refreshAfterWrite())
.isEqualTo(original.refreshAfterWrite());
if (original.refreshAfterWrite()) {
Expand All @@ -147,7 +148,8 @@ private void checkRefreshAfterWrite(BoundedLocalCache<?, ?> original, BoundedLoc
}
}

private void checkEviction(BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
private void checkEviction(
BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
check("evicts()").that(copy.evicts()).isEqualTo(original.evicts());
check("weigher()").that(unwrapWeigher(copy.weigher))
.isInstanceOf(unwrapWeigher(original.weigher).getClass());
Expand All @@ -156,7 +158,8 @@ private void checkEviction(BoundedLocalCache<?, ?> original, BoundedLocalCache<?
}
}

private void checkExpiresAfterAccess(BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
private void checkExpiresAfterAccess(
BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
check("expiresAfterAccess()").that(copy.expiresAfterAccess())
.isEqualTo(original.expiresAfterAccess());
if (original.expiresAfterAccess()) {
Expand All @@ -165,7 +168,8 @@ private void checkExpiresAfterAccess(BoundedLocalCache<?, ?> original, BoundedLo
}
}

private void checkExpiresAfterWrite(BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
private void checkExpiresAfterWrite(
BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
check("expiresAfterWrite()").that(copy.expiresAfterWrite())
.isEqualTo(original.expiresAfterWrite());
if (original.expiresAfterWrite()) {
Expand All @@ -174,7 +178,8 @@ private void checkExpiresAfterWrite(BoundedLocalCache<?, ?> original, BoundedLoc
}
}

private void checkExpiresVariable(BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
private void checkExpiresVariable(
BoundedLocalCache<?, ?> original, BoundedLocalCache<?, ?> copy) {
check("expiresVariable()").that(copy.expiresVariable())
.isEqualTo(original.expiresVariable());
if (original.expiresVariable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ private void status() {
local.readBuffer.size(), pendingWrites);
System.out.printf(US, "Drain status = %s (%s)%n", STATUS[drainStatus], drainStatus);
System.out.printf(US, "Evictions = %,d%n", cache.stats().evictionCount());
System.out.printf(US, "Size = %,d (max: %,d)%n", local.data.mappingCount(), workload.maxEntries);
System.out.printf(US, "Size = %,d (max: %,d)%n",
local.data.mappingCount(), workload.maxEntries);
System.out.printf(US, "Lock = [%s%n", StringUtils.substringAfter(
local.evictionLock.toString(), "["));
System.out.printf(US, "Pending reloads = %,d%n", local.refreshes.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ public CompletableFuture<Value> asyncLoad(Key key, Executor executor) {
}

private void startWaiting() {
ScheduledFuture<?> oldSchedule = schedule.getAndSet(timer.schedule(this::doLoad, maxDelay, MILLISECONDS));
ScheduledFuture<?> oldSchedule = schedule.getAndSet(
timer.schedule(this::doLoad, maxDelay, MILLISECONDS));
if (oldSchedule != null) {
oldSchedule.cancel(false);
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ext {
junit5: '5.9.1',
junitTestNG: '1.0.4',
lincheck: '2.16',
mockito: '4.9.0',
mockito: '4.10.0',
osgiSvcComponent: '1.5.0',
osgiUtilFunction: '1.2.0',
osgiUtilPromise: '1.2.0',
Expand Down

0 comments on commit 412e0d0

Please sign in to comment.