From a42a4df73614b1d7e25975b249f22d395d93d734 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 27 May 2026 11:51:36 -0400 Subject: [PATCH] fix(android): silence JVM + Kotlin annotation-target warnings Two cleanups around the noise at the top of every CI log: * CI workflow: JAVA_TOOL_OPTIONS=--enable-native-access=ALL-UNNAMED at the workflow env level so both build + release jobs apply it to the launcher JVM (not just the daemon). The launcher is the one loading native-platform.jar via System.load. * Kotlin compiler: -Xannotation-default-target=param-property in kotlin.compilerOptions.freeCompilerArgs. Opts every @Inject / @ApplicationContext / @ApplicationScope constructor-parameter annotation into the future Kotlin 2.3 behavior (apply to both param AND property), clearing the 11 warnings on AuthController / AuthStore / MutationReplayer / SyncController / EventsStream / LiveEventsDispatcher / PlayEventsReporter / PlayerController / PlayerFactory / ResumeController. Co-Authored-By: Claude Opus 4.7 (1M context) --- .forgejo/workflows/android.yml | 9 +++++++++ android/app/build.gradle.kts | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/.forgejo/workflows/android.yml b/.forgejo/workflows/android.yml index 08b9a8b5..cf8e28df 100644 --- a/.forgejo/workflows/android.yml +++ b/.forgejo/workflows/android.yml @@ -17,6 +17,15 @@ on: paths: - 'android/**' +env: + # Silences the JDK 22+ "restricted method in java.lang.System has been + # called" warning that Gradle 9.1's bundled native-platform jar trips + # at launch (System.load for native primitives). Affects the LAUNCHER + # JVM, not the daemon — that's why org.gradle.jvmargs in + # gradle.properties isn't enough. Future-compat: required opt-in once + # JDK 25 promotes the warning to an error. + JAVA_TOOL_OPTIONS: "--enable-native-access=ALL-UNNAMED" + jobs: build: name: Build + lint + test diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index ed07c04e..87d52cf9 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -86,6 +86,14 @@ android { kotlin { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) + // Opt into the future Kotlin behavior: annotations on + // constructor parameters apply to both the param AND the + // generated property/field. Without this flag, Kotlin 2.x + // emits a deprecation warning at every @Inject / + // @ApplicationContext / @ApplicationScope constructor- + // parameter use. Setting it now matches what becomes the + // default in Kotlin 2.3 (KT-73255). + freeCompilerArgs.add("-Xannotation-default-target=param-property") } }