diff --git a/build.gradle b/build.gradle index 3edf4f8..41cc28c 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ plugins { id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'com.github.ben-manes.versions' version '0.52.0' id "me.champeau.jmh" version "0.7.3" - id "net.ltgt.errorprone" version '4.2.0' + id "net.ltgt.errorprone" version '4.3.0' // Kotlin just for tests - not production code id 'org.jetbrains.kotlin.jvm' version '2.2.0' @@ -97,7 +97,7 @@ dependencies { jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.37' errorprone 'com.uber.nullaway:nullaway:0.12.7' - errorprone 'com.google.errorprone:error_prone_core:2.37.0' + errorprone 'com.google.errorprone:error_prone_core:2.40.0' // just tests testCompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' diff --git a/settings.gradle b/settings.gradle index d5a82f4..0f127bf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradle.develocity' version '4.0.2' + id 'com.gradle.develocity' version '4.1' id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0' } diff --git a/src/main/java/org/dataloader/ValueCache.java b/src/main/java/org/dataloader/ValueCache.java index 80c8402..b06fdb8 100644 --- a/src/main/java/org/dataloader/ValueCache.java +++ b/src/main/java/org/dataloader/ValueCache.java @@ -3,6 +3,7 @@ import org.dataloader.annotations.PublicSpi; import org.dataloader.impl.CompletableFutureKit; import org.dataloader.impl.NoOpValueCache; +import org.jspecify.annotations.Nullable; import org.jspecify.annotations.NullMarked; import java.util.ArrayList; @@ -40,7 +41,7 @@ */ @PublicSpi @NullMarked -public interface ValueCache { +public interface ValueCache { /** * Creates a new value cache, using the default no-op implementation. diff --git a/src/test/kotlin/org/dataloader/KotlinExamples.kt b/src/test/kotlin/org/dataloader/KotlinExamples.kt index 480a965..f53faf4 100644 --- a/src/test/kotlin/org/dataloader/KotlinExamples.kt +++ b/src/test/kotlin/org/dataloader/KotlinExamples.kt @@ -1,8 +1,10 @@ package org.dataloader +import java.util.concurrent.CompletableFuture import org.junit.jupiter.api.Test import reactor.core.publisher.Flux import java.util.concurrent.CompletableFuture.completedFuture +import org.dataloader.impl.NoOpValueCache /** * Some Kotlin code to prove that are JSpecify annotations work here @@ -81,6 +83,19 @@ class KotlinExamples { standardNullableAsserts(dataLoader) } + @Test + fun `basic kotlin test of nullable value types in value cache`() { + val valueCache = object : ValueCache by NoOpValueCache() { + override fun get(key: String): CompletableFuture = if (key == "null") + completedFuture(null) + else + completedFuture(key) + } + + assert(valueCache["key"].get() == "key") + assert(valueCache["null"].get() == null) + } + private fun standardNullableAsserts(dataLoader: DataLoader) { val cfA = dataLoader.load("A") val cfB = dataLoader.load("B") pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy