Clean up imports and remove ExperimentalEncodingApi opt-in#505
Merged
Conversation
Several files referenced classes by their full package path inline (e.g. com.greenart7c3.nostrsigner.models.TorMode.DISABLED) instead of importing them. Add the proper imports and use simple names for TorManager, TorMode, Build, EncryptedDataKind, TextAlign, CancellationException, Base64, Secp256k1Instance, Locale, and URI. Also drop the @OptIn(ExperimentalEncodingApi::class) annotations — kotlin.io.encoding.Base64 is stable since Kotlin 2.2 (the project is on 2.4.0), and Nip44v3Test already used it without opt-in. IntentUtils now uses kotlin.io.encoding.Base64 for the GZIP callback encoding too (identical RFC 4648 output to java.util.Base64.getEncoder()), removing the name clash that forced the fully-qualified references. Verified with ktlintCheck, lint, and the full unit test suite (Gradle 9.6.1 distribution is not downloadable in this environment; checks ran on cached Gradle 9.5.1, hence --no-verify with the same hook commands run manually). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S8M2ZDp1g2jTg7v6Yq9ATs
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.
Summary
This PR consolidates and simplifies imports across the codebase by removing redundant fully-qualified names and eliminating the
@OptIn(ExperimentalEncodingApi::class)annotation. The KotlinBase64andCancellationExceptionclasses are now imported at the top of files where they're used, improving code readability and reducing visual clutter.Key Changes
@OptIn(ExperimentalEncodingApi::class)and added top-level imports forBase64andCancellationException; replaced allkotlin.io.encoding.Base64andkotlinx.coroutines.CancellationExceptionfully-qualified references with their imported namesjava.util.Base64tokotlin.io.encoding.Base64; removed@OptIn(ExperimentalEncodingApi::class)and replacedBase64.getEncoder().encodeToString()withBase64.encode()Base64import and removed@OptIn(ExperimentalEncodingApi::class); replaced fully-qualifiedkotlin.io.encoding.Base64referencesBase64andSecp256k1Instance; replaced fully-qualified references with imported namesBuildandTorMode; replacedandroid.os.Build.SUPPORTED_ABISandcom.greenart7c3.nostrsigner.models.TorMode.DISABLEDwith imported namesURIimport; replacedjava.net.URIfully-qualified referenceLocaleimport; replacedjava.util.Locale.ROOTfully-qualified referenceEncryptedDataKindimport; replaced fully-qualified referenceTorManagerimport; replaced fully-qualified referenceTextAlignimport; replacedandroidx.compose.ui.text.style.TextAlign.Endfully-qualified referenceImplementation Details
The
kotlin.io.encoding.Base64API is now stable in recent Kotlin versions, so the@OptInannotation is no longer necessary. All changes maintain functional equivalence while improving code clarity through proper import organization.https://claude.ai/code/session_01S8M2ZDp1g2jTg7v6Yq9ATs