Skip to content

Commit

Permalink
resolve qodana static analysis warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Apr 25, 2023
1 parent f56173a commit e161a26
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 31 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/qodana.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: 11

jobs:
qodana:
Expand Down Expand Up @@ -49,11 +49,6 @@ jobs:
services.gradle.org:443
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Build
uses: ./.github/actions/run-gradle
with:
java: ${{ env.JAVA_VERSION }}
arguments: build -x test
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@61b94e7e3a716dcb9e2030cfd79cd46149d56c26 # v2023.1.0
- name: Upload SARIF file for GitHub Advanced Security Dashboard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ void expireVariableEntries(long now) {
}
}

/** Returns the duration until the next item expires, or {@link Long.MAX_VALUE} if none. */
/** Returns the duration until the next item expires, or {@link Long#MAX_VALUE} if none. */
@GuardedBy("evictionLock")
long getExpirationDelay(long now) {
long delay = Long.MAX_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ <K1 extends K, V1 extends V> Weigher<K1, V1> getWeigher(boolean isAsync) {
* {@link Cache#estimatedSize()}, but will never be visible to read or write operations; such
* entries are cleaned up as part of the routine maintenance described in the class javadoc.
* <p>
* This feature cannot be used in conjunction when {@link #weakKeys()} is combined with
* {@link #buildAsync}.
* This feature cannot be used in conjunction when {@link #evictionListener(RemovalListener)} is
* combined with {@link #buildAsync}.
*
* @return this {@code Caffeine} instance (for chaining)
* @throws IllegalStateException if the key strength was already set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ BiFunction<Set<? extends K>, Executor, CompletableFuture<Map<K, V>>> newBulkMapp
return (keysToLoad, executor) -> {
try {
@SuppressWarnings("unchecked")
var loaded = (CompletableFuture<Map<K, V>>) (Object) cacheLoader
.asyncLoadAll(keysToLoad, executor);
var loaded = (CompletableFuture<Map<K, V>>) cacheLoader.asyncLoadAll(keysToLoad, executor);
return loaded;
} catch (RuntimeException e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ static void soProducerLimit(BaseMpscLinkedArrayQueue<?> self, long v) {
* An ordered store(store + StoreStore barrier) of an element to a given offset
*
* @param buffer this.buffer
* @param offset computed via {@link org.jctools.util.UnsafeRefArrayAccess#calcElementOffset}
* @param offset computed
* @param e an orderly kitty
*/
static <E> void soElement(E[] buffer, long offset, E e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

/**
* A base class providing the mechanics for supporting dynamic striping of bounded buffers. This
* implementation is an adaption of the numeric 64-bit {@link java.util.concurrent.atomic.Striped64}
* implementation is an adaption of the numeric 64-bit <i>java.util.concurrent.atomic.Striped64</i>
* class, which is used by atomic counters. The approach was modified to lazily grow an array of
* buffers in order to minimize memory usage for caches that are not heavily contended on.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void unlink(Node<K, V> node) {
}
}

/** Returns the duration until the next bucket expires, or {@link Long.MAX_VALUE} if none. */
/** Returns the duration until the next bucket expires, or {@link Long#MAX_VALUE} if none. */
@SuppressWarnings("IntLongMath")
public long getExpirationDelay() {
for (int i = 0; i < SHIFT.length; i++) {
Expand Down Expand Up @@ -265,7 +265,7 @@ public long getExpirationDelay() {
}

/**
* Returns the duration when the wheel's next bucket expires, or {@link Long.MAX_VALUE} if empty.
* Returns the duration when the wheel's next bucket expires, or {@link Long#MAX_VALUE} if empty.
*
* @param index the timing wheel being operated on
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@

/**
* This package contains in-memory caching functionality. All cache variants are configured and
* created by using the {@link Caffeine} builder.
* created by using the {@link com.github.benmanes.caffeine.cache.Caffeine} builder.
* <p>
* A {@link Cache} provides similar characteristics as
* {@link java.util.concurrent.ConcurrentHashMap} with additional support for policies to bound the
* map by. When built with a {@link CacheLoader}, the {@link LoadingCache} variant allows the cache
* to populate itself on miss and offers refresh capabilities.
* map by. When built with a {@link com.github.benmanes.caffeine.cache.CacheLoader}, the
* {@link com.github.benmanes.caffeine.cache.LoadingCache} variant allows the cache to populate
* itself on miss and offers refresh capabilities.
* <p>
* A {@link AsyncCache} is similar to a {@link Cache} except that a cache entry holds a
* A {@link com.github.benmanes.caffeine.cache.AsyncCache} is similar to a
* {@link com.github.benmanes.caffeine.cache.Cache} except that a cache entry holds a
* {@link java.util.concurrent.CompletableFuture} of the value. This entry will be automatically
* removed if the future fails, resolves to {@code null}, or based on an eviction policy. When built
* with a {@link AsyncCacheLoader}, the {@link AsyncLoadingCache} variant allows the cache to
* populate itself on miss and offers refresh capabilities.
* with a {@link com.github.benmanes.caffeine.cache.AsyncCacheLoader}, the
* {@link com.github.benmanes.caffeine.cache.AsyncLoadingCache} variant allows the cache to populate
* itself on miss and offers refresh capabilities.
* <p>
* Additional functionality such as bounding by the entry's size, removal notifications, statistics,
* and eviction policies are described in the {@link Caffeine} builder.
* and eviction policies are described in the {@link com.github.benmanes.caffeine.cache.Caffeine}
* builder.
*
* @author ben.manes@gmail.com (Ben Manes)
*/
Expand Down
6 changes: 4 additions & 2 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
version: "1.0"
projectJDK: 11
projectJDK: temurin-11
profile:
name: qodana.recommended
exclude:
- name: CastCanBeRemovedNarrowingVariableType
- name: CommentedOutCode
- name: ConstantValue
- name: DanglingJavadoc
- name: DataFlowIssue
- name: EmptyStatementBody
- name: EqualsWhichDoesntCheckParameterClass
- name: GrUnnecessarySemicolon
- name: GroovyEmptyStatementBody
- name: GroovyUnnecessaryReturn
- name: GrUnnecessarySemicolon
- name: IgnoreResultOfCall
- name: Java9CollectionFactory
- name: JavaAnnotator
- name: JavadocLinkAsPlainText
- name: JavaRequiresAutoModule
- name: NonSynchronizedMethodOverridesSynchronizedMethod
- name: NotNullFieldNotInitialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ private void validateStatus() {
/** Prints out the internal state of the policy. */
private void printClock() {
System.out.println("** CLOCK-Pro list HEAD (small recency) **");
System.out.println(listHead.toString());
System.out.println(listHead);
for (Node n = listHead.next; n != listHead; n = n.next) {
System.out.println(n.toString());
System.out.println(n);
}
System.out.println("** CLOCK-Pro list TAIL (large recency) **");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,9 @@ private void validateStatus() {
/** Prints out the internal state of the policy. */
private void printClock() {
System.out.println("** CLOCK-Pro list HEAD (small recency) **");
System.out.println(listHead.toString());
System.out.println(listHead);
for (Node n = listHead.next; n != listHead; n = n.next) {
System.out.println(n.toString());
System.out.println(n);
}
System.out.println("** CLOCK-Pro list TAIL (large recency) **");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,21 +333,21 @@ private void printClock() {
if (sizeCold > 0) {
System.out.println("** CLOCK-Pro list COLD HEAD (small recency) **");
for (Node n = headCold.next; n != headCold; n = n.next) {
System.out.println(n.toString());
System.out.println(n);
}
System.out.println("** CLOCK-Pro list COLD TAIL (large recency) **");
}
if (sizeHot > 0) {
System.out.println("** CLOCK-Pro list HOT HEAD (small recency) **");
for (Node n = headHot.next; n != headHot; n = n.next) {
System.out.println(n.toString());
System.out.println(n);
}
System.out.println("** CLOCK-Pro list HOT TAIL (large recency) **");
}
if (sizeNR > 0) {
System.out.println("** CLOCK-Pro list NR HEAD (small recency) **");
for (Node n = headNonResident.next; n != headNonResident; n = n.next) {
System.out.println(n.toString());
System.out.println(n);
}
System.out.println("** CLOCK-Pro list NR TAIL (large recency) **");
}
Expand Down

0 comments on commit e161a26

Please sign in to comment.