ADFA-4649: Remove com.blankj:utilcodex (AndroidUtilCode) dependency#1576
ADFA-4649: Remove com.blankj:utilcodex (AndroidUtilCode) dependency#1576davidschachterADFA wants to merge 11 commits into
Conversation
…ve equivalents Adds Context.dpToPx()/spToPx() extensions to common's ContextUtils.kt, matching blankj SizeUtils' rounding formula exactly, and swaps all 22 com.blankj.utilcode SizeUtils/ConvertUtils.dp2px call sites across app, editor, uidesigner, xml-inflater, and common-ui to use them. First of several staged commits removing the com.blankj:utilcodex dependency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…helpers Adds a shared mainThreadHandler to common's TaskExecutor.kt and updates its existing runOnUiThread() to post through it instead of blankj's ThreadUtils. Swaps all com.blankj.utilcode ThreadUtils.runOnUiThread/ getMainHandler/runOnUiThreadDelayed call sites across app, lsp/models, lsp/java, and uidesigner to use it - preserving the same Handler instance for post/removeCallbacks pairs where cancellation depends on it. Second of several staged commits removing com.blankj:utilcodex. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds native FileUtils/FileIOUtils objects to common's utils package, matching blankj's method names/signatures (isUtf8, readFile2String, writeFileFromString, listFilesInDirWithFilter, delete, rename, getFileExtension, createOrExistsDir) so call sites only needed an import swap, not a rewrite. Covers app, editor, xml-inflater, and common modules. Third of several staged commits removing com.blankj:utilcodex. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ive equivalents Adds copyToClipboard/isNetworkConnected/isSoftInputVisible extensions to common's ContextUtils.kt (the latter using WindowInsetsCompat's IME visibility check instead of blankj's decor-view-height heuristic). Updates the CloneRepositoryViewModelTest mock to stub the new extension via mockkStatic on the facade class instead of blankj's NetworkUtils object. Fourth of several staged commits removing com.blankj:utilcodex. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…lents - ThrowableUtils.getFullStackTrace -> Throwable.stackTraceToString() (Kotlin stdlib) - ConvertUtils.byte2MemorySize/MemoryConstants -> inline division - AppUtils.getAppVersionCode -> new Context.getAppVersionCode() extension - DeviceUtils.getManufacturer/getModel/isEmulator/isDeviceRooted -> ported onto the project's own (same-name, same-package) DeviceUtils object - CloseUtils.closeIO -> direct try/close - ArrayUtils.contains -> IntStream.anyMatch - StringUtils.isTrimEmpty -> inline null/trim check - Utils.getApp() -> BaseApplication.baseInstance - ActivityUtils.startActivity -> IDEApplication.instance.startActivity - ActivityUtils.getTopActivity() -> new BaseApplication.foregroundActivity, tracked via a lifecycle-callbacks registration in BaseApplication.onCreate() (common module can't depend on IDEApplication in app); IDEApplication's own more precise Pre/Post-based tracker now overrides it Fifth of several staged commits removing com.blankj:utilcodex. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…h native equivalents Adds four new common-module utility objects, each a same-name drop-in so call sites only needed an import swap: - ReflectUtils: a compact fluent reflection helper (reflect/field/ method/newInstance/get) covering exactly the subset used across lsp/java, javac-services, and xml-inflater - field lookup uses the field's declared type when wrapping, matching blankj's behavior bug-for-bug (verified via javap against the actual blankj bytecode) so existing call chains keep working identically. - ImageUtils: isImage (BitmapFactory decode-bounds check), getBitmap, and getImageType (magic-number header sniffing for JPG/PNG/GIF/TIFF/ BMP/ICO/WEBP). - ResourceUtils: copyFileFromAssets (recursive directory-aware asset copy, matching blankj) and readAssets2String, both via BaseApplication.baseInstance.assets. - ZipUtils: unzipFile using java.util.zip.ZipFile, with zip-slip path-traversal protection added as a safe hardening. Sixth of several staged commits removing com.blankj:utilcodex. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Drops the utilcodex dependency declaration from all 12 modules that had it (app, common, editor, uidesigner, xml-inflater, actions, lsp/api, lsp/java, lsp/models, lsp/xml, subprojects/javac-services, subprojects/flashbar) and its now-unused entries from gradle/libs.versions.toml. Verified: zero com.blankj.utilcode source references remain, :app:compileV8DebugKotlin/JavaWithJavac builds clean, unit tests pass (190 tests, 0 failures) across app/common/ editor/xml-inflater/lsp-java, a full :app:assembleV8Debug succeeds, and the resulting debug APK contains no blankj/utilcode classes. Final commit removing com.blankj:utilcodex (AndroidUtilCode/blankj) - duplicated AndroidX core, Kotlin stdlib, and coroutines functionality that this app now covers with small native equivalents, shrinking the APK. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
…y tracker Per architecture review: common can't depend on app (IDEApplication), so this base tracker exists for common-module consumers (FlashbarUtils); IDEApplication's own pre-existing Pre/Post-callback tracker overrides it and wins at runtime in the real app. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Architecture reviewRan the This is a mechanical dependency-removal — every file swaps a blankj
Summary: 0 violations, 1 non-blocking warning (addressed with a doc comment), rest checked and clean. |
|
Warning Review limit reached
Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (96)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…code' into fix/ADFA-4649-remove-blankj-utilcode
Code review: two blocking regressions in the blankj replacementsI diffed each new in-house util against the actual blankj 1.31.1 sources. Most substitutions are faithful, but two change behavior in ways that are reachable in normal use. 1.
|
Summary
com.blankj:utilcodex("AndroidUtilCode") dependency entirely — it duplicated functionality AndroidX core, Kotlin stdlib, and coroutines already provide, per the ticket.SizeUtils/ConvertUtilsdp↔px conversions →Context.dpToPx()/spToPx()extensionsThreadUtils→ a sharedmainThreadHandler+ nativerunOnUiThread()FileUtils/FileIOUtils→ same-name native drop-ins (isUtf8, readFile2String, writeFileFromString, listFilesInDirWithFilter, delete, rename, getFileExtension, createOrExistsDir) so most call sites only needed an import swapClipboardUtils/KeyboardUtils/NetworkUtils→Contextextensions (copyToClipboard,isNetworkConnected,isSoftInputVisibleviaWindowInsetsCompat's IME check instead of blankj's decor-view-height heuristic)DeviceUtils,AppUtils,ThrowableUtils.getFullStackTrace→ Kotlin'sstackTraceToString(),CloseUtils,ArrayUtils,StringUtils,Utils.getApp()/ActivityUtils→BaseApplication)ReflectUtilsport (verified bug-for-bug against the actual blankj bytecode viajavap, since a couple of call sites inUnEnter.ktchain in a way that only works if the port matches blankj's exact field-wrapping semantics), plusImageUtils,ResourceUtils(recursive asset copy),ZipUtils(with zip-slip protection added as a safe hardening)libs.versions.tomlVerification
com.blankj.utilcodesource references remain anywhere in the repo:app:compileV8DebugKotlin/compileV8DebugJavaWithJavacbuild clean after each stage:app:assembleV8Debugsucceeds; resulting APK contains zero blankj/utilcode classesspotlessCheckpasses (pre-push hook)Test plan
🤖 Generated with Claude Code