Skip to content

Commit

Permalink
dependency updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Nov 2, 2024
1 parent 3457bf5 commit d4ccc16
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Dependency Review
uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5
uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0
with:
license-check: false
comment-summary-in-pr: on-failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: check -x test
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@4f04143e8d52028fee27c2a219c8856035094962 # v2024.2.5
uses: JetBrains/qodana-action@31d6f3309b31c566758e1314a3d9ef0dff75ecbd # v2024.2.6
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
objects.githubusercontent.com:443
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Typos
uses: crate-ci/typos@0d9e0c2c1bd7f770f6eb90f87780848ca02fc12c # v1.26.8
uses: crate-ci/typos@d01f29c66d1bf1a08730750f61d86c210b0d039d # v1.27.0
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Year;
import java.time.ZoneId;
import java.util.ArrayList;
Expand Down Expand Up @@ -144,6 +143,7 @@ private NavigableMap<String, ImmutableSet<Feature>> getClassNameToFeatures() {
return classNameToFeatures;
}

@SuppressWarnings("SetsImmutableEnumSetIterable")
private ImmutableSet<Feature> getFeatures(List<Object> combination) {
var features = new LinkedHashSet<Feature>();
features.add(((Boolean) combination.get(0)) ? Feature.STRONG_KEYS : Feature.WEAK_KEYS);
Expand All @@ -156,6 +156,7 @@ private ImmutableSet<Feature> getFeatures(List<Object> combination) {
if (features.contains(Feature.MAXIMUM_WEIGHT)) {
features.remove(Feature.MAXIMUM_SIZE);
}
// In featureByIndex order for class naming
return ImmutableSet.copyOf(features);
}

Expand All @@ -164,6 +165,7 @@ private Set<List<Object>> combinations() {
return Sets.cartesianProduct(sets);
}

@SuppressWarnings("SetsImmutableEnumSetIterable")
private TypeSpec makeLocalCacheSpec(String className,
boolean isFinal, ImmutableSet<Feature> features) {
TypeName superClass;
Expand All @@ -174,8 +176,9 @@ private TypeSpec makeLocalCacheSpec(String className,
generateFeatures = features;
superClass = BOUNDED_LOCAL_CACHE;
} else {
// Requires that parentFeatures is in featureByIndex order for super class naming
parentFeatures = ImmutableSet.copyOf(Iterables.limit(features, features.size() - 1));
generateFeatures = ImmutableSet.of(features.asList().get(features.size() - 1));
generateFeatures = Sets.immutableEnumSet(features.asList().get(features.size() - 1));
superClass = ParameterizedTypeName.get(ClassName.bestGuess(
encode(Feature.makeClassName(parentFeatures))), kTypeVar, vTypeVar);
}
Expand Down Expand Up @@ -208,6 +211,6 @@ private static String encode(String className) {
}

public static void main(String[] args) throws FormatterException, IOException {
new LocalCacheFactoryGenerator(Paths.get(args[0])).generate();
new LocalCacheFactoryGenerator(Path.of(args[0])).generate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Year;
import java.time.ZoneId;
import java.util.ArrayList;
Expand Down Expand Up @@ -146,6 +145,7 @@ private NavigableMap<String, ImmutableSet<Feature>> getClassNameToFeatures() {
return classNameToFeatures;
}

@SuppressWarnings("SetsImmutableEnumSetIterable")
private ImmutableSet<Feature> getFeatures(List<Object> combination) {
var features = new LinkedHashSet<Feature>();
features.add((Feature) combination.get(0));
Expand All @@ -158,9 +158,11 @@ private ImmutableSet<Feature> getFeatures(List<Object> combination) {
if (features.contains(Feature.MAXIMUM_WEIGHT)) {
features.remove(Feature.MAXIMUM_SIZE);
}
// In featureByIndex order for class naming
return ImmutableSet.copyOf(features);
}

@SuppressWarnings("SetsImmutableEnumSetIterable")
private TypeSpec makeNodeSpec(String className, boolean isFinal, ImmutableSet<Feature> features) {
TypeName superClass;
ImmutableSet<Feature> parentFeatures;
Expand All @@ -170,8 +172,9 @@ private TypeSpec makeNodeSpec(String className, boolean isFinal, ImmutableSet<Fe
generateFeatures = features;
superClass = TypeName.OBJECT;
} else {
// Requires that parentFeatures is in featureByIndex order for super class naming
parentFeatures = ImmutableSet.copyOf(Iterables.limit(features, features.size() - 1));
generateFeatures = ImmutableSet.of(features.asList().get(features.size() - 1));
generateFeatures = Sets.immutableEnumSet(features.asList().get(features.size() - 1));
superClass = ParameterizedTypeName.get(ClassName.get(PACKAGE_NAME,
encode(Feature.makeClassName(parentFeatures))), kTypeVar, vTypeVar);
}
Expand Down Expand Up @@ -215,6 +218,6 @@ private static String encode(String className) {
}

public static void main(String[] args) throws FormatterException, IOException {
new NodeFactoryGenerator(Paths.get(args[0])).generate();
new NodeFactoryGenerator(Path.of(args[0])).generate();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ auto-value = "1.11.0"
awaitility = "4.2.2"
bcel = "6.10.0"
bnd = "7.0.0"
bouncycastle-jdk18on = "1.78.1"
bouncycastle-jdk18on = "1.79"
cache2k = "2.6.1.Final"
caffeine = "3.1.8"
checker-framework = "3.48.1"
checkstyle = "10.18.2"
checker-framework = "3.48.2"
checkstyle = "10.20.0"
coherence = "22.06.2"
commons-collections4 = "4.4"
commons-compress = "1.27.1"
Expand All @@ -19,12 +19,12 @@ commons-text = "1.12.0"
concurrentlinkedhashmap = "1.4.2"
config = "1.4.3"
coveralls = "2.12.2"
dependency-check = "11.0.0"
dependency-check = "11.1.0"
eclipse-collections = "12.0.0.M3"
ehcache3 = "3.10.8"
errorprone = "2.35.1"
errorprone-plugin = "4.1.0"
errorprone-support = "0.18.0"
errorprone-support = "0.19.0"
expiring-map = "0.5.11"
fast-filter = "1.0.2"
fastutil = "8.5.15"
Expand All @@ -42,7 +42,7 @@ hazelcast = "5.3.7"
httpclient = "4.5.14"
idea = "1.1.9"
jackrabbit = "1.70.0"
jackson = "2.18.0"
jackson = "2.18.1"
jacoco = "0.8.12"
jakarta-inject = "2.0.1"
jamm = "0.4.0"
Expand All @@ -68,7 +68,7 @@ kotlin = "2.0.21"
lincheck = "2.34"
mockito = "5.14.2"
nexus-publish = "2.0.0"
nullaway = "0.12.0"
nullaway = "0.12.1"
nullaway-plugin = "2.1.0"
okhttp-bom = "4.12.0"
okio-bom = "3.9.1"
Expand All @@ -86,7 +86,7 @@ snakeyaml = "2.3"
sonarqube = "5.1.0.4882"
spotbugs = "4.8.6"
spotbugs-contrib = "7.6.5"
spotbugs-plugin = "6.0.25"
spotbugs-plugin = "6.0.26"
stream = "2.9.8"
tcache = "2.0.1"
testng = "7.10.2"
Expand All @@ -96,7 +96,7 @@ versions = "0.51.0"
xz = "1.10"
ycsb = "0.17.0"
zero-allocation-hashing = "0.26ea0"
zstd = "1.5.6-6"
zstd = "1.5.6-7"

[libraries]
asm-bom = { module = "org.ow2.asm:asm-bom", version.ref = "asm" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies {

val javaVersion = JavaLanguageVersion.of(System.getenv("JAVA_VERSION")?.toIntOrNull() ?: 11)
val javaVendor = System.getenv("JAVA_VENDOR")?.let { JvmVendorSpec.matching(it) }
val javaLtsVersion = JavaLanguageVersion.of(21)
java.toolchain {
languageVersion = javaVersion
vendor = javaVendor
Expand All @@ -33,7 +34,7 @@ tasks.withType<JavaCompile>().configureEach {

javaCompiler = javaToolchains.compilerFor {
// jdk 17+ is required by compiler plugins, e.g. error-prone
languageVersion = maxOf(javaVersion, JavaLanguageVersion.of(21))
languageVersion = maxOf(javaVersion, javaLtsVersion)
}

options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-auxiliaryclass", "-Xlint:-classfile",
Expand Down Expand Up @@ -88,9 +89,8 @@ tasks.withType<Javadoc>().configureEach {
use()
quiet()
noTimestamp()
if (javaVersion.canCompileOrRun(18)) {
addStringOption("-link-modularity-mismatch", "info")
}
addStringOption("-release", javaVersion.toString())
addStringOption("-link-modularity-mismatch", "info")
links(
"https://checkerframework.org/api/",
"https://errorprone.info/api/latest/",
Expand All @@ -104,4 +104,7 @@ tasks.withType<Javadoc>().configureEach {
dependsOn(":caffeine:javadoc")
}
}
javadocTool.set(javaToolchains.javadocToolFor({
languageVersion = maxOf(javaVersion, javaLtsVersion)
}))
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ dependencies {
tasks.withType<Test>().configureEach {
inputs.property("javaVendor", java.toolchain.vendor.get().toString())

// Use --debug-jvm to remotely attach to the test task
jvmArgs("-XX:SoftRefLRUPolicyMSPerMB=0", "-XX:+EnableDynamicAgentLoading", "-Xshare:off")
if ("debug" in systemProperties) {
jvmArgs("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
}
jvmArgs(defaultJvmArgs())
if (isCI()) {
reports.junitXml.includeSystemOutLog = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ fun errorChecks() = listOf(
fun disabledChecks() = listOf(
"AvoidObjectArrays",
"AndroidJdkLibsChecker",
"ConstantNaming",
"IsInstanceLambdaUsage",
"Java7ApiChecker",
"Java8ApiChecker",
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.io.SequenceInputStream;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.List;
import java.util.function.UnaryOperator;
Expand Down Expand Up @@ -138,7 +138,7 @@ protected BufferedInputStream readInput(InputStream input) {

/** Returns the input stream for the raw file. */
private InputStream openFile() throws IOException {
var file = Paths.get(filePath);
var file = Path.of(filePath);
if (Files.exists(file)) {
return Files.newInputStream(file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static java.util.Locale.US;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -77,6 +78,7 @@
import com.github.benmanes.caffeine.cache.simulator.policy.two_queue.TwoQueuePolicy;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.typesafe.config.Config;

/**
Expand Down Expand Up @@ -242,7 +244,7 @@ Set<Characteristic> characteristics() {
var policySpec = policyClass().getAnnotation(PolicySpec.class);
return (policySpec == null)
? ImmutableSet.of()
: ImmutableSet.copyOf(policySpec.characteristics());
: Sets.immutableEnumSet(Arrays.asList(policySpec.characteristics()));
}

static Factory of(Class<? extends Policy> policyClass, Function<Config, Set<Policy>> creator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,22 +201,21 @@ public enum EvictionPolicy {
/** Evicts entries based on insertion order. */
FIFO {
@Override Node select(List<Node> sample, Random random, long tick) {
return sample.stream().min(Comparator.comparingLong(
node -> node.insertionTime)).orElseThrow();
return Collections.min(sample, Comparator.comparingLong(node -> node.insertionTime));
}
},

/** Evicts entries based on how recently they are used, with the least recent evicted first. */
LRU {
@Override Node select(List<Node> sample, Random random, long tick) {
return sample.stream().min(Comparator.comparingLong(node -> node.accessTime)).orElseThrow();
return Collections.min(sample, Comparator.comparingLong(node -> node.accessTime));
}
},

/** Evicts entries based on how recently they are used, with the least recent evicted first. */
MRU {
@Override Node select(List<Node> sample, Random random, long tick) {
return sample.stream().max(Comparator.comparingLong(node -> node.accessTime)).orElseThrow();
return Collections.max(sample, Comparator.comparingLong(node -> node.accessTime));
}
},

Expand All @@ -225,7 +224,7 @@ public enum EvictionPolicy {
*/
LFU {
@Override Node select(List<Node> sample, Random random, long tick) {
return sample.stream().min(Comparator.comparingInt(node -> node.frequency)).orElseThrow();
return Collections.min(sample, Comparator.comparingInt(node -> node.frequency));
}
},

Expand All @@ -234,7 +233,7 @@ public enum EvictionPolicy {
*/
MFU {
@Override Node select(List<Node> sample, Random random, long tick) {
return sample.stream().max(Comparator.comparingInt(node -> node.frequency)).orElseThrow();
return Collections.max(sample, Comparator.comparingInt(node -> node.frequency));
}
},

Expand All @@ -249,8 +248,7 @@ public enum EvictionPolicy {
/** Evicts entries based on how frequently they are used divided by their age. */
HYPERBOLIC {
@Override Node select(List<Node> sample, Random random, long tick) {
return sample.stream().min(Comparator.comparingDouble(
node -> hyperbolic(node, tick))).orElseThrow();
return Collections.min(sample, Comparator.comparingDouble(node -> hyperbolic(node, tick)));
}
double hyperbolic(Node node, long tick) {
return node.frequency / (double) (tick - node.insertionTime);
Expand Down

0 comments on commit d4ccc16

Please sign in to comment.