fix(kotlin): stop deprecations pointing at deprecated replacements - #731
Open
ayaangazali wants to merge 1 commit into
Open
fix(kotlin): stop deprecations pointing at deprecated replacements#731ayaangazali wants to merge 1 commit into
ayaangazali wants to merge 1 commit into
Conversation
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.
Contributor
Author
|
Heads up on the red Both are red on main too, at I opened #736 with the evidence and a one-line guard. Nothing to do on this PR; every other check here is green. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
Six
@Deprecatedmessages 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:unloadModelmodels.unload(category)@Deprecated("Use unloadAll(category).")stopSynthesistts.stop()@Deprecated("Use the SpeechHandle returned by speak().")stopSpeakingtts.stop()streamVADvad.detectStream(audio, options)@Deprecated("Use vad.openStream(format, options).")resetVADvad.detectStreamtranscribeStreamstt.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.
ReplaceWithis 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.shtracks 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 theSpeechHandlereturned bytts.speak()vad.openStream(format, options), andclose()on theVadStreamit returns for the reset casestt.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) returningSpeechHandlewithinterrupt()(Results.kt:252),SttNamespace.openStream(:189), andVadStream.close()(Results.kt:315).Message strings only. No signature, body, or
ReplaceWithtarget changes, so this cannot alter behaviour.How I found them
Collected the deprecated methods declared inside
public/api/*Namespace.kt, then looked for any@Deprecatedmessage 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: cleangit statusshows only the four source files; the codegen the Gradle build runs left nothing behindNo test added: these are annotation strings, and a test asserting the text of a deprecation message would pin prose rather than behaviour.