refactor: migrate MParticleIdentityClient to Kotlin (Lane C, part 1) - #778
Conversation
Kotlin migration progressThis PR migrates 13 lines of Java to Kotlin (+0.0 pp).
Migration goal progress: 23.3% (Kotlin LOC as a share of everything that is not a designated public-API facade.) 126 Java files / 49 Kotlin files in scope. Largest Java files still to migrate
|
6a31a86 to
9716d9f
Compare
9716d9f to
5c8104e
Compare
5b1f8d2 to
3005277
Compare
PR SummaryLow Risk Overview The Java file is removed and replaced by a Kotlin interface with the same four identity HTTP operations ( Reviewed by Cursor Bugbot for commit 6ae7760. Bugbot is set up for automated code reviews on this repo. Configure here. |
Brings `workstation/kotlin-migration` up to date with `main`. ##⚠️ Merge this with "Create a merge commit" — not squash, not rebase The branch already contains a real merge commit with two parents (`7907bbe4` from the integration branch, `a1377d39` from `main`). Squashing would flatten the upstream commits into one synthetic commit on the integration branch and lose the branch point; rebasing would rewrite `main`'s commits with new SHAs. Either one makes the eventual `workstation/kotlin-migration` → `main` merge harder to read and harder to bisect. ## What it picks up | | | | --- | --- | | [#616](#616) | chore: bump androidx.test.ext:junit from 1.1.4 to 1.3.0 | | [#769](#769) | docs: trim AGENTS.md to the non-derivable core and add CLAUDE.md | | [#784](#784) | chore: bump actions/setup-java from 5 to 6 | | [#765](#765) | chore: bump gradle/actions/setup-gradle from 5.0.2 to 6.3.0 | | [#764](#764) | chore: bump trunk-io/trunk-action from 1.3.1 to 2.0.0 | | [#775](#775) | chore: prepare release 6.0.4 | 14 files, +194 / −211. **No conflicts.** ## Why the migration tooling is unaffected Nothing on `main` touched `android-core` or `android-kit-base` `src/main`, so the committed `api/*.api` files are still exact. The androidTest manifest and `testutils/build.gradle` junit bump do not affect the public API guard or the Kotlin migration tracker. Stacked PRs #777 and #778 will rebase onto this once it lands. Made with [Cursor](https://cursor.com)
3005277 to
21262a9
Compare
21262a9 to
c0a2987
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c0a2987. Configure here.
Converts the identity leaf interface MParticleIdentityClient. Zero public API diff (verified with scripts/api-guard.sh check) — this file lives outside com.mparticle.internal, so any diff here is a hard gate failure, not just a reviewable one. Each method keeps @throws(Exception::class) to preserve the `throws` clause Java callers compile against; Kotlin has no checked exceptions by default, so dropping this annotation would silently change the bytecode-visible throws clause even though the guard's plain javap -public diff doesn't show it (javap -public without -v doesn't print throws clauses either, so this one wouldn't even trip the guard — caught it by matching the plan's own hazard table, not by the tool). MParticleUserImpl (Lane C's other easy-tier file, 157 LOC) is deliberately not included here. It has three package-private members (setUserIdentities, setUserIdentity, setUserDelegate/mUserDelegate) that testutils/AccessUtils.java calls directly from a separate Gradle module. Kotlin has no package-private visibility: converting those to `internal` breaks that cross-module Java call site (internal is module-scoped and name-mangled on the JVM), and dodging the mangling with @JvmName makes them permanently public — a real, if obscure, ABI addition in a frozen file. Needs a coordinated PR with AccessUtils.java/IdentityApi.java or a restructured test hook; tracked as a follow-up rather than folded in here. Local ktlintCheck and unit tests could not run in this environment — Maven Central is rate-limiting dependency resolution (429). Compile and api-guard both ran clean against the real build; the commit hook's own ktlint pass (cached deps) was clean. CI will run the full suite. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
c0a2987 to
6ae7760
Compare

Lane C — identity leaf classes, part 1 (1 of 2 files, 13 of 170 LOC)
Stacked on #777 (Lane E) — merge that one first. Part of the Java→Kotlin migration (PLAN.md).
Converts
identity/MParticleIdentityClient. Zero public API diff (bash scripts/api-guard.sh checkpasses) — this file lives outsidecom.mparticle.internal, so any diff here is a hard gate failure, not a reviewable one. Each method keeps@Throws(Exception::class)to preserve thethrowsclause Java callers compile against.MParticleUserImplis deliberately NOT in this PRLane C's other easy-tier file (157 LOC) turned out to have a real hazard: it has three package-private members (
setUserIdentities,setUserIdentity,setUserDelegate/mUserDelegate) thattestutils/AccessUtils.javacalls directly — from a separate Gradle module.Kotlin has no package-private visibility. The closest equivalent,
internal, is module-scoped and name-mangled on the JVM, so converting these would break that cross-module Java call site outright. Working around the mangling with@JvmNamecompiles, but makes those three members permanently public in the ABI — a real (if obscure) addition to a frozen-by-default file, which is exactly what this migration is supposed to avoid.This needs either a coordinated PR that also converts
AccessUtils.java/IdentityApi.java, or a restructured test hook. Filing as a follow-up rather than folding it in here or quietly accepting the API growth. Worth adding toPLAN.md's hazard table — package-private Java members with cross-module Java callers are a distinct case from the ones already documented.Validation
./gradlew :android-core:compileDebugKotlin :android-core:compileDebugJavaWithJavac— clean./gradlew :android-kit-base:compileDebugKotlin :android-kit-base:compileDebugJavaWithJavac— cleanbash scripts/api-guard.sh check— passed, zero diffbash scripts/kotlin-migration-progress.sh— 23.3% → 23.3% (rounds the same at one decimal; LOC moved 16,752 → 16,739)ktlintCheck/unit tests could not run in this environment — Maven Central is rate-limiting dependency resolution (429). The commit hook's own ktlint pass (cached deps) was clean. CI will run the full suite.Draft while CI runs — flip to ready once green, and once #777 merges so this rebases onto
workstation/kotlin-migrationdirectly.