Skip to content

Commit

Permalink
upgrade errorprone and nullaway static analyzers
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Oct 20, 2023
1 parent 2fc358c commit 10cb288
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/actions/run-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
required: true
description: The JDK version
early-access:
default: '21'
default: '22'
required: false
description: The early access release
graal:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
forbiddenApis:
runs-on: ubuntu-latest
env:
JAVA_VERSION: 20
JAVA_VERSION: 21
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
Expand All @@ -42,7 +42,7 @@ jobs:
pmd:
runs-on: ubuntu-latest
env:
JAVA_VERSION: 20
JAVA_VERSION: 21
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
Expand All @@ -60,7 +60,7 @@ jobs:
spotbugs:
runs-on: ubuntu-latest
env:
JAVA_VERSION: 20
JAVA_VERSION: 21
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on: [ push, pull_request ]
env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
PUBLISH_JDK: 20
PUBLISH_JDK: 21

jobs:
benchmarks:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 20, 21, GraalVM ]
java: [ 11, 21, 22, GraalVM ]
env:
JAVA_VERSION: ${{ matrix.java }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ env:
schemastore.org:443
www.graalvm.org:443
PUBLISH_JDK: 11
EA_JDK: 21
EA_JDK: 22

jobs:
compile:
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 20, 21, GraalVM ]
java: [ 11, 21, 22, GraalVM ]
env:
JAVA_VERSION: ${{ matrix.java }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ permissions:
env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 20
JAVA_VERSION: 21

jobs:
analyze:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions: read-all
env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 20
JAVA_VERSION: 21

jobs:
dependency-check:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions: read-all
env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 20
JAVA_VERSION: 21

jobs:
dependency-submission:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [ push, pull_request ]
env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 20
JAVA_VERSION: 21
SNAPSHOT: true

jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,18 +563,18 @@ public void testToArray2() {
// mustEqual(y, x);
// }

static final int SIZE = 10000;
static ConcurrentMap<Long, Long> longMap;

static ConcurrentMap<Long, Long> longMap() {
if (longMap == null) {
longMap = bounded();
for (int i = 0; i < SIZE; ++i) {
longMap.put(Long.valueOf(i), Long.valueOf(2 *i));
}
}
return longMap;
}
// static final int SIZE = 10000;
// static ConcurrentMap<Long, Long> longMap;
//
// static ConcurrentMap<Long, Long> longMap() {
// if (longMap == null) {
// longMap = bounded();
// for (int i = 0; i < SIZE; ++i) {
// longMap.put(Long.valueOf(i), Long.valueOf(2 *i));
// }
// }
// return longMap;
// }

// explicit function class to avoid type inference problems
static class AddKeys implements BiFunction<Map.Entry<Long,Long>, Map.Entry<Long,Long>, Map.Entry<Long,Long>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
*/
@SuppressWarnings({"AnnotateFormatMethod", "CollectionToArray", "EqualsIncompatibleType",
"FunctionalInterfaceClash", "JavaUtilDate", "JUnit3FloatingPointComparisonWithoutDelta",
"NumericEquality", "rawtypes", "ReferenceEquality",
"NonFinalStaticField", "NumericEquality", "rawtypes", "ReferenceEquality",
"RethrowReflectiveOperationExceptionAsLinkageError", "serial", "SwitchDefault",
"ThreadPriorityCheck", "try", "unchecked", "UndefinedEquals"})
public class JSR166TestCase extends TestCase {
Expand Down
12 changes: 6 additions & 6 deletions examples/coalescing-bulkloader-reactor/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[Reactor][reactor] data streams facilitate the consolidation of independent asynchronous loads into
batches at the cost of a small buffering delay. The [bufferTimeout][] operator accumulates requests
until reaching a maximum size or time limit. Since each request consists of a key and its pending
result, when the subscriber is notified it performs the batch load and completes the key's future
with its corresponding value.

It some scenarios it may be desirable to only aggregate cache refreshes rather than imposing delays
on callers awaiting explicit loads. An automated reload initiated by `refreshAfterWrite` will occur
on the first stale request for an entry. While the key is being refreshed the previous value
continues to be returned, in contrast to eviction which forces retrievals to wait until the value
is loaded anew. In such cases, batching these optimistic reloads can minimize the impact on the
source system without adversely affecting the responsiveness of the explicit requests.

[Reactor][reactor] data streams facilitate the consolidation of independent asynchronous loads into
batches at the cost of a small buffering delay. The [bufferTimeout][] operator accumulates requests
until reaching a maximum size or time limit. Since each request consists of a key and its pending
result, when the subscriber is notified it performs the batch load and completes the key's future
with its corresponding value.

### Refresh coalescing
A [Sink][sink] collects requests, buffering them up to the configured threshold, and subsequently
delivers the batch to the subscriber. The `parallelism` setting determines the number of concurrent
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
org.gradle.jvmargs=-Xmx2g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError
org.gradle.java.installations.fromEnv=JDK_CI
systemProp.sonar.gradle.skipCompile=true
org.gradle.configuration-cache=true
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ coveralls = "2.12.2"
dependency-check = "8.4.0"
eclipse-collections = "12.0.0.M3"
ehcache3 = "3.10.8"
errorprone-core = "2.22.0"
errorprone-core = "2.23.0"
errorprone-plugin = "3.1.0"
errorprone-support = "0.14.0"
expiring-map = "0.5.11"
Expand Down Expand Up @@ -64,7 +64,7 @@ kotlin = "1.9.10"
lincheck = "2.18.1"
mockito = "5.6.0"
nexus-publish = "2.0.0-rc-1"
nullaway-core = "0.10.14"
nullaway-core = "0.10.15"
nullaway-plugin = "1.6.0"
ohc = "0.6.1"
osgi-annotations = "1.5.1"
Expand All @@ -81,7 +81,7 @@ snakeyaml = "2.2"
sonarqube = "4.4.1.3373"
spotbugs-contrib = "7.6.0"
spotbugs-core = "4.8.0"
spotbugs-plugin = "6.0.0-beta.5"
spotbugs-plugin = "6.0.0-rc.2"
stream = "2.9.8"
tcache = "2.0.1"
testng = "7.8.0"
Expand Down
13 changes: 10 additions & 3 deletions gradle/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ dependencies {
}

tasks.withType<DependencyUpdatesTask> {
val ignoredGroups = listOf("org.jetbrains.kotlin", "org.gradle.kotlin.kotlin-dsl")
rejectVersionIf {
(candidate.group in ignoredGroups) && (candidate.version != currentVersion)
resolutionStrategy {
componentSelection {
val ignoredGroups = listOf("org.jetbrains.kotlin", "org.gradle.kotlin.kotlin-dsl")
all {
if ((candidate.group in ignoredGroups) && (candidate.version != currentVersion)) {
reject("kotlin dsl")
}
}
}
force(libs.bnd)
}
}
1 change: 1 addition & 0 deletions gradle/plugins/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.java.installations.fromEnv=JDK_CI
systemProp.sonar.gradle.skipCompile=true
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
}
}
force(libs.guice)
force(libs.lincheck)
force(libs.bundles.coherence.get())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ fun enabledChecks() = listOf(
"MissingDefault",
"MutableGuiceModule",
"NoAllocation",
"NonFinalStaticField",
"OverridingMethodInconsistentArgumentNamesChecker",
"PackageLocation",
"PreferredInterfaceType",
Expand All @@ -120,6 +121,7 @@ fun enabledChecks() = listOf(
"RemoveUnusedImports",
"ReturnsNullCollection",
"SelfAlwaysReturnsThis",
"StringFormatWithLiteral",
"StronglyTypeByteString",
"StronglyTypeTime",
"SwitchDefault",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ final class KeySetView extends ForwardingSet<K> {
@Override public boolean removeIf(Predicate<? super K> filter) {
return delegate().removeIf(filter);
}
@SuppressWarnings("NullAway")
@Override public boolean remove(Object o) {
return (o != null) && delegate().remove(o);
}
Expand All @@ -221,6 +222,7 @@ final class ValuesView extends ForwardingCollection<V> {
}

final class EntrySetView extends ForwardingSet<Entry<K, V>> {
@SuppressWarnings("NullAway")
@Override public boolean add(Entry<K, V> entry) {
throw new UnsupportedOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
public final class TypesafeConfigurator {
static final Logger logger = System.getLogger(TypesafeConfigurator.class.getName());

@SuppressWarnings("NonFinalStaticField")
static ConfigSource configSource = TypesafeConfigurator::resolveConfig;
@SuppressWarnings("NonFinalStaticField")
static FactoryCreator factoryCreator = FactoryBuilder::factoryOf;

private TypesafeConfigurator() {}
Expand Down

0 comments on commit 10cb288

Please sign in to comment.