Skip to content

Commit

Permalink
fix snyk and resolve qodana analysis warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Jul 23, 2023
1 parent 0bedba1 commit b7e0ddf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ env:
ALLOWED_ENDPOINTS: >
api.adoptium.net:443
api.github.com:443
api.snapcraft.io:443
artifactcache.actions.githubusercontent.com:443
caffeine.gradle-enterprise.cloud:443
cdn.azul.com:443
cloudflare.com:443
docker.io:443
download.java.net:443
downloads.gradle.org:443
downloads.gradle-dn.com:443
Expand All @@ -31,6 +33,7 @@ env:
repo1.maven.org:443
scans-in.gradle.com:443
services.gradle.org:443
schemastore.org:443
www.graalvm.org:443
PUBLISH_JDK: 11
EA_JDK: 21
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test
args: --sarif-file-output=snyk.sarif
args: --sarif-file-output=snyk.sarif -- --no-configuration-cache
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ private CacheProxy<K, V> newCacheProxy() {

/** Creates a cache that reads through on a cache miss. */
private CacheProxy<K, V> newLoadingCacheProxy() {
CacheLoader<K, V> cacheLoader = config.getCacheLoaderFactory().create();
var factory = config.getCacheLoaderFactory();
if (factory == null) {
throw new IllegalStateException();
}

CacheLoader<K, V> cacheLoader = factory.create();
JCacheLoaderAdapter<K, V> adapter = new JCacheLoaderAdapter<>(
cacheLoader, dispatcher, expiryPolicy, ticker, statistics);
CacheProxy<K, V> cache = new LoadingCacheProxy<>(cacheName, executor, cacheManager, config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public CaffeineConfiguration<K, V> removeCacheEntryListenerConfiguration(
}

@Override
public Factory<CacheLoader<K, V>> getCacheLoaderFactory() {
public @Nullable Factory<CacheLoader<K, V>> getCacheLoaderFactory() {
return delegate.getCacheLoaderFactory();
}

Expand All @@ -189,15 +189,16 @@ public CaffeineConfiguration<K, V> setCacheLoaderFactory(
}

@Override
public Factory<CacheWriter<? super K, ? super V>> getCacheWriterFactory() {
public @Nullable Factory<CacheWriter<? super K, ? super V>> getCacheWriterFactory() {
return delegate.getCacheWriterFactory();
}

/** Returns a writer created by the configured factory or null if not set. */
public @Nullable CacheWriter<K , V> getCacheWriter() {
if (hasCacheWriter()) {
var factory = delegate.getCacheWriterFactory();
if (factory != null) {
@SuppressWarnings("unchecked")
CacheWriter<K , V> writer = (CacheWriter<K, V>) getCacheWriterFactory().create();
CacheWriter<K , V> writer = (CacheWriter<K, V>) factory.create();
return writer;
}
return null;
Expand Down
3 changes: 2 additions & 1 deletion qodana.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: "1.0"
projectJDK: temurin-11
linter: jetbrains/qodana-jvm-community:2023.1
linter: jetbrains/qodana-jvm-community:2023.2
profile:
name: qodana.recommended
exclude:
- name: AutoCloseableResource
- name: CastCanBeRemovedNarrowingVariableType
- name: ClassEscapesItsScope
- name: CommentedOutCode
- name: ConstantValue
- name: DanglingJavadoc
Expand Down

0 comments on commit b7e0ddf

Please sign in to comment.