Repository navigation
test: expose explicit test seams for package-private core internals - #845
Conversation
📦 SDK Size Impact ReportWhat the SDK adds to a minified release APK. Measured 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 SDK
➡️ SDK size impact change is minimal. Raw measurementsTarget branch: {"baseline_dex_bytes": 0, "baseline_download_bytes": 2516, "baseline_install_bytes": 7532, "core_dex_bytes": 218896, "core_download_bytes": 122926, "core_install_bytes": 130177}This PR: {"baseline_dex_bytes": 0, "baseline_download_bytes": 2513, "baseline_install_bytes": 7529, "core_dex_bytes": 218884, "core_download_bytes": 122939, "core_install_bytes": 130192} |
5940248 to
4f6fd62
Compare
PR SummaryLow Risk Overview All updated members are annotated with Reviewed by Cursor Bugbot for commit 5cc29ef. Bugbot is set up for automated code reviews on this repo. Configure here. |
2ab1576 to
a1f60cf
Compare
The testutils module reaches package-private members of android-core by declaring helper classes in the same package names across the module boundary, which only works while those classes stay in Java. This makes the members testutils depends on public and marks each with @VisibleForTesting and @RestrictTo(LIBRARY_GROUP): the MessageHandler class, UploadHandler.mApiClient and setApiClient, ConfigManager.deleteConfigManager and clearMpid, MessageManager.mMessageHandler and mInstallType, BaseHandler.await, KitFrameworkWrapper.mKitManager, getFrameworkLoadAttempted, setKitManager and setKitsLoaded, MParticleIdentityClientImpl's endpoint path constants and getUrl overloads, MParticleUserImpl.setUserIdentities, and MParticleBaseClientImpl.mApiKey. No behaviour, names, types or nullability change, and the classes kept in full by proguard.pro are untouched, so the published API surface is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
a1f60cf to
5cc29ef
Compare
Problem
The unpublished
testutilsmodule reaches package-private members ofandroid-coreby declaring helper classes in the same package names across the module boundary (com.mparticle.AccessUtils,com.mparticle.identity.AccessUtils,com.mparticle.internal.AccessUtils,MockServer). Kotlin has no package-private visibility, so those seams break the moment any of the core classes involved is converted.Change
The members
testutilsdepends on becomepublic, each annotated@VisibleForTestingand@RestrictTo(LIBRARY_GROUP):MessageHandler(class),MessageManager.mMessageHandlerandmInstallType,BaseHandler.awaitUploadHandler.mApiClientandsetApiClientConfigManager.deleteConfigManagerandclearMpidKitFrameworkWrapper.mKitManager,getFrameworkLoadAttempted,setKitManager,setKitsLoadedMParticleIdentityClientImplendpoint path constants andgetUrloverloads,MParticleUserImpl.setUserIdentitiesMParticleBaseClientImpl.mApiKeyNo behaviour, name, type or nullability changes. Facade classes (
MParticle,MParticleOptions,IdentityApi,MPUrl) and every classproguard.prokeeps in full are untouched;PushRegistrationHelper.setPushRegistrationstays package-private for that reason.MessageHandleruses@VisibleForTesting(otherwise = PACKAGE_PRIVATE)because the default scope is not valid on a class.Verification
testutilsand the core and kit-base unit and androidTest source sets compile.:android-core:testDebugUnitTest310/310 and:android-kit-base:testDebugUnitTest89/89, matchingmain;ktlintCheckand corelintpass with 0 errors.javap -publicof the R8-processed releaseclasses.jaris identical tomainfor every classproguard.pronames, exceptMParticleIdentityClientImpl, where the two internally usedgetUrloverloads now appear public under their obfuscated names. No class kept with{ *; }changed.🤖 Generated with Claude Code