fix(jetbrains): replace internal badge-icon APIs in worktree row icons - #13831
Merged
1 commit merged intoSep 6, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
verifyPlugin failed the 7.1.6-rc.1 publish with 5 INTERNAL_API_USAGES violations, all from WorktreeIcons.live(): com.intellij.ui.BadgeIcon, BadgeDotProvider, and BadgeShapeProvider are @ApiStatus.Internal on the platform version this plugin targets (IU-261) and were only promoted to stable in a later platform release. The public alternatives (IconManager.withIconBadge, ExecutionUtil.withLiveIndicator) hardcode dot geometry tuned for a 20px stripe icon, which overhangs a 16px base and would widen the worktree row's icon column for running rows only -- exactly what the existing custom geometry was written to avoid. Add LiveBadgeIcon, a Kilo-owned Icon following the same pattern as DotIcon/ActivityIcon/FilledBadgeIcon: plain javax.swing.Icon, antialiased Graphics2D painting, geometry as fractions of the base icon's own size. Reproduces the exact pixels of the previous implementation with zero internal API usage. Confirmed via `./gradlew verifyPlugin`: 5 internal API usages -> 0.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 90.1K · Output: 12.6K · Cached: 186K Review guidance: REVIEW.md from base branch |
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
verifyPluginfailed the7.1.6-rc.1publish run (run) with:All 5 usages came from
WorktreeIcons.live()(introduced in #13712):com.intellij.ui.BadgeIcon,BadgeDotProvider, andBadgeShapeProviderare@ApiStatus.Internalon the platform version this plugin targets (IU-261) — they were only promoted to stable in a later platform release (confirmed against$INTELLIJ_REPO, commit99a9aeacba02"Promote BadgeIcon to stable").Nothing was published; the run failed before the Marketplace/GitHub Release steps.
Why not just use the public
withIconBadge/withLiveIndicator?Both delegate to the same internal
BadgeIcon(icon, color)with the platform's default dot geometry, which is tuned for a 20px stripe icon. On a 16px base the hole overhangs the edge, andHoledIconreports the icon's size as the union of glyph + hole — so a 16px base would report ~18px and widen the worktree row's icon column for running rows only. That's exactly what the existing custom geometry (x=0.75, y=0.25, radius=0.175, border=0.075) was written to avoid, and what two existing tests assert against.Fix
Added
LiveBadgeIcon(ui/LiveBadgeIcon.kt) — a Kilo-ownedIconfollowing the same house pattern asDotIcon/ActivityIcon/FilledBadgeIcon: plainjavax.swing.Icon, antialiasedGraphics2Dpainting, geometry as fractions of the base icon's own size. Reproduces the previous pixels exactly (same fractions, same clip-then-fill approach used by the platform'sHoledIcon/BadgeIcon), with zero internal API usage.WorktreeIcons.live()now returnsLiveBadgeIconinstead of the platform'sBadgeIcon. Tests updated to target the new type, plus one new paint test verifying the badge actually renders the base glyph and a success-colored, opaque dot (using a synthetic base icon, since real platform icons resolve to a no-opDummyIconImplunderBasePlatformTestCase).Verification
From
packages/kilo-jetbrains/:./gradlew typecheck— pass./gradlew test— pass (all suites, including 21/21 inWorktreeIconsTest)./gradlew verifyPlugin— the check that failed publish:INTERNAL_API_USAGESdropped from 5 to 0; result is nowCompatible.