From 99e8ffcdebf929dc551e742e1e769c64a34980c8 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 17:14:31 +0100 Subject: [PATCH] Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable. --- .../amethyst/service/lang/LanguageTranslatorService.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt index bf1f8e109..886298d51 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt @@ -34,6 +34,7 @@ import com.linkedin.urls.detection.UrlDetector import com.linkedin.urls.detection.UrlDetectorOptions import com.vitorpamplona.amethyst.service.checkNotInMainThread import kotlinx.coroutines.CancellationException +import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import java.util.regex.Pattern @@ -45,7 +46,7 @@ data class ResultOrError( ) object LanguageTranslatorService { - var executorService = Executors.newCachedThreadPool() + var executorService: ExecutorService = Executors.newCachedThreadPool() private val options = LanguageIdentificationOptions @@ -54,8 +55,8 @@ object LanguageTranslatorService { .setConfidenceThreshold(0.6f) .build() private val languageIdentification = LanguageIdentification.getClient(options) - val lnRegex = Pattern.compile("\\blnbc[a-z0-9]+\\b", Pattern.CASE_INSENSITIVE) - val tagRegex = + val lnRegex: Pattern = Pattern.compile("\\blnbc[a-z0-9]+\\b", Pattern.CASE_INSENSITIVE) + val tagRegex: Pattern = Pattern.compile( "(nostr:)?@?(nsec1|npub1|nevent1|naddr1|note1|nprofile1|nrelay1)([qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)", Pattern.CASE_INSENSITIVE,