Repository navigation
refactor(android SDK): convert NetworkConnection and MParticleBaseClientImpl to Kotlin - #1005
Conversation
Kotlin migration progressThis pull request converts 473 lines of Java to Kotlin.
Conversion progress: 34.3% (10,866 of 16,550 baseline Java LOC left to convert). 94 Java files and 74 Kotlin files in scope. |
Binary compatibility
Compares this branch with the last version published to Maven Central, both built without R8, over the public classes and members that release keeps under their own names. It also checks that this branch's release AAR still keeps them (see the script docstring). Full japicmp HTML/XML reports are attached as the |
📦 SDK Size Impact ReportWhat the SDK adds to a minified release APK. mParticle Core SDKMeasured against an empty baseline app. Unlike the Rokt kit, android-core ships no Compose and no resources, so there is nothing here that a host app would already provide.
mParticle Core + Rokt kitMeasured against a Compose + Material3 reference app, so these are the costs on top of an app that already ships Compose. The reference app's dependencies are a documented convention, not a measured average: see
Rokt SDK+ umbrella (adds the payment extension)
➡️ SDK size impact change is minimal. Raw measurementscore, Target branch: {"baseline_dex_bytes": 0, "baseline_download_bytes": 2514, "baseline_install_bytes": 7528, "core_dex_bytes": 223684, "core_download_bytes": 124582, "core_install_bytes": 131833}core, This PR: {"baseline_dex_bytes": 0, "baseline_download_bytes": 2513, "baseline_install_bytes": 7529, "core_dex_bytes": 224388, "core_download_bytes": 124851, "core_install_bytes": 132102}rokt, Target branch: {"baseline_dex_bytes": 1829108, "baseline_download_bytes": 1240062, "baseline_install_bytes": 1300934, "kit_dex_bytes": 4173692, "kit_download_bytes": 2548321, "kit_install_bytes": 2623275, "sdkplus_dex_bytes": 9297648, "sdkplus_download_bytes": 7987550, "sdkplus_install_bytes": 8165359}rokt, This PR: {"baseline_dex_bytes": 1829108, "baseline_download_bytes": 1240062, "baseline_install_bytes": 1300934, "kit_dex_bytes": 4173860, "kit_download_bytes": 2548489, "kit_install_bytes": 2623275, "sdkplus_dex_bytes": 9297816, "sdkplus_download_bytes": 7987808, "sdkplus_install_bytes": 8165359} |
29dfd0c to
846841f
Compare
jamesnrokt
left a comment
There was a problem hiding this comment.
Approved — NetworkConnection and MParticleBaseClientImpl match the Java, including pinning, pod routing and every endpoint path.
…entImpl to Kotlin
846841f to
20e1070
Compare
Why
Risk class M.
This pull request converts row B2 of the Kotlin migration tracker from Java to Kotlin:
NetworkConnectionandMParticleBaseClientImpl. Neither class is kept by the ProGuard configuration, so R8 renames both in the published AAR.Programme
The Java-to-Kotlin migration of
android-core, the migration tracker row B2 (Stack B, networking), converted using the Kotlinkotlin-tooling-java-to-kotlinskill and the migration playbook. Row B3 (MParticleApiClientImpl) stacks on this pull request.What changes
NetworkConnectionandMParticleBaseClientImplto Kotlin incom.mparticle.networking.MParticleBaseClientImplagainstMParticleBaseClientImplTest,NetworkOptionsTest, andEndpointTest. The version 1, version 2, and version 4 path prefixes,REQUEST_ID,resolveHostpriority,getPodUrlpod redirection, and everywhen (endpoint)branch ingetUrlmatch the Java implementation.NetworkConnectionagainstMParticleBaseClientImplTestandPinningTest.makeUrlRequestappliesgetSocketFactory()before opening the gzipped output stream, andgetSocketFactory()loads a defaultKeyStore, parses all default andDomainMappingX509 certificates, and initializesTrustManagerFactoryand the TLSSSLContext.getUrl(five overloads),generateDefaultURLandREQUEST_IDstayprotected, as in the Java, and the Kotlin androidTests in the same package reach them through a small Java helper (BaseClientAccess) and Kotlin extensions;isPostGingerBreadwas package-private and is@RestrictTo(LIBRARY_GROUP) protected open;Endpoint.parseIntcarries@JvmStaticand@RestrictTo(LIBRARY_GROUP); unannotated parameters are nullable (T?) and dereferenced with!!. The fourmakeUrlRequestoverloads returnMPConnection?,getHeaderHashStringreturnsString?,generateDefaultURLreturnsMPUrl?, andgetPodPrefix(apiKey.orEmpty())keeps the Java behaviour for a null API key.Companionfield and an empty$Companionclass onMParticleBaseClientImpl,MParticleBaseClientImpl.EndpointandNetworkConnection, plusEndpoint.getEntries(). The frozen-API check counts these as changes, so this pull request needs theapi-change-approvedlabel after API review.Linked work
Follows row B1 (#985); row B3 (
MParticleApiClientImpl) stacks on this branch.Rollout
Merges with no release and reaches apps in the next SDK release. Revert the squash commit to roll back. Risk class M: the stack's QA smoke run is needed before the next M-class pull request in Stack B merges.
Risks
MParticleBaseClientImplTest,NetworkOptionsTest,EndpointTest, andPinningTest.getUrl,generateDefaultURLandREQUEST_IDkeep their Javaprotectedvisibility, so a Java subclass that overrides them still compiles.Who
Prepared by an automated coding agent as row B2 of the migration tracker and reviewed by the SDK team before merge.
Size
657 lines added and 504 removed across 11 files: 2 Kotlin files replacing 2 Java files, 1 import line in
UploadHandler, 1 visibility modifier inMParticleBaseClientImplTest, themakeUrlRequestoverride inMParticleIdentityClientImplTest, two androidTest helper files, the API dump, and the migration playbook.