Skip to content

fix(kotlin): stop deprecations pointing at deprecated replacements - #731

Open
ayaangazali wants to merge 1 commit into
RunanywhereAI:mainfrom
ayaangazali:fix/kotlin-deprecation-targets
Open

fix(kotlin): stop deprecations pointing at deprecated replacements#731
ayaangazali wants to merge 1 commit into
RunanywhereAI:mainfrom
ayaangazali:fix/kotlin-deprecation-targets

Conversation

@ayaangazali

Copy link
Copy Markdown
Contributor

What is wrong

Six @Deprecated messages on the legacy extension surface tell the caller to move to a namespace method that is itself deprecated, so following the advice lands them on a second deprecation:

legacy extension current advice that target's own annotation
unloadModel models.unload(category) @Deprecated("Use unloadAll(category).")
stopSynthesis tts.stop() @Deprecated("Use the SpeechHandle returned by speak().")
stopSpeaking tts.stop() same
streamVAD vad.detectStream(audio, options) @Deprecated("Use vad.openStream(format, options).")
resetVAD vad.detectStream same
transcribeStream stt.transcribeStream(audio, options) @Deprecated("Use stt.openStream(format, options).")

The IDE shows the strikethrough and the message, the caller migrates, and gets struck through again. ReplaceWith is not involved in any of these, so nothing auto-applies, but the written guidance is a dead end and no gate covers it. check_deprecated_surfaces.sh tracks which deprecated surfaces exist against an allowlist; it does not check that a deprecation's target is supported.

What this changes

Each message now names the replacement the namespace's own annotation points at, so one hop reaches a supported API:

  • models.unloadAll(category)
  • interrupt() on the SpeechHandle returned by tts.speak()
  • vad.openStream(format, options), and close() on the VadStream it returns for the reset case
  • stt.openStream(format, options)

I took each target from the deprecated namespace method's own annotation rather than picking one, and confirmed the members exist: ModelsNamespace.unloadAll (:266), TtsNamespace.speak (:60) returning SpeechHandle with interrupt() (Results.kt:252), SttNamespace.openStream (:189), and VadStream.close() (Results.kt:315).

Message strings only. No signature, body, or ReplaceWith target changes, so this cannot alter behaviour.

How I found them

Collected the deprecated methods declared inside public/api/*Namespace.kt, then looked for any @Deprecated message elsewhere naming <namespace>.<method> for that set. Six hits, four files. After the change the same scan reports zero.

Worth noting the scan produced 31 raw hits at first and 25 were false positives, because a deprecated extension and the live namespace method often share a simple name (generate, rerank, diarize). Those messages are correct and I left them alone; only the six above name a target that really is deprecated.

Verification

  • ./gradlew :compileDebugKotlin --rerun-tasks -x :buildLocalJniLibs -x :downloadJniLibs -x :syncAndroidRuntimeLibs -Prunanywhere.useLocalNatives=false: BUILD SUCCESSFUL
  • ./gradlew ktlintMainSourceSetCheck: clean
  • git status shows only the four source files; the codegen the Gradle build runs left nothing behind

No test added: these are annotation strings, and a test asserting the text of a deprecation message would pin prose rather than behaviour.

Six @deprecated messages on the legacy extension surface name a namespace
method that is itself deprecated, so following the migration advice lands the
caller on a second deprecation:

  unloadModel      -> models.unload(category)          @deprecated -> unloadAll(category)
  stopSynthesis    -> tts.stop()                       @deprecated -> SpeechHandle
  stopSpeaking     -> tts.stop()                       @deprecated -> SpeechHandle
  streamVAD        -> vad.detectStream(audio, options) @deprecated -> openStream(format, options)
  resetVAD         -> vad.detectStream                 @deprecated -> openStream(format, options)
  transcribeStream -> stt.transcribeStream(audio, ...) @deprecated -> openStream(format, options)

Each now names the replacement the namespace's own annotation points at, so
one hop reaches a supported API:

  models.unloadAll(category)
  interrupt() on the SpeechHandle returned by tts.speak()
  vad.openStream(format, options) / close() on the VadStream it returns
  stt.openStream(format, options)

Messages only. No signatures, bodies, or annotations targets change.
Copilot AI lite review requested due to automatic review settings August 17, 2026 18:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Heads up on the red python-linux (3.9) and (3.12) cells here: they are not from this diff.

Both are red on main too, at b2d2ff6d (run 32011099890), with "The job has exceeded the maximum execution time of 1h30m0s". The job hangs inside auditwheel repair because the prep step's ln -sf libonnxruntime.so lib/libonnxruntime.so.1 overwrites the middle link of the chain the new RunAnywhere desktop prebuilt ships, turning libonnxruntime.so and libonnxruntime.so.1 into a symlink loop.

I opened #736 with the evidence and a one-line guard. Nothing to do on this PR; every other check here is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants