Qualify imports that hid their receiver - #3130
Merged
StylianosGakis merged 1 commit intoSep 8, 2026
Merged
Conversation
StylianosGakis
force-pushed
the
chore/qualify-namespace-imports
branch
from
September 4, 2026 13:48
f27a011 to
5c2497e
Compare
StylianosGakis
force-pushed
the
chore/qualify-namespace-imports
branch
from
September 4, 2026 14:26
5c2497e to
a452cac
Compare
StylianosGakis
changed the base branch from
chore/lint-config-fixes
to
chore/delete-empty-lint-baselines
September 4, 2026 14:27
StylianosGakis
force-pushed
the
chore/qualify-namespace-imports
branch
from
September 4, 2026 16:52
a452cac to
cd9a21c
Compare
StylianosGakis
marked this pull request as ready for review
September 7, 2026 14:54
Fixes every existing violation of the import rule: 26 imports across 12 files. Res.string.FOO and Clock.System.now() are restored at their use sites in the feature files that had shortened them away. Nineteen of the rest are design system Defaults members whose owning object lives in the same file, so they are now qualified as TooltipDefaults.defaultStyle and the like, matching what TopAppBar.kt already did. References from inside an owning object's own body are untouched, since they resolve without an import and gain nothing from the prefix. TopAppBar.kt's import turned out to be unused except for one call in TopAppBarLayoutForActions, which has no windowInsets parameter of its own and was silently reading the import.
StylianosGakis
force-pushed
the
chore/qualify-namespace-imports
branch
from
September 7, 2026 15:00
cd9a21c to
3ae370e
Compare
panasetskaya
approved these changes
Sep 7, 2026
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.
Fix all the wrongly imported places in the app manually, where we did
string.foorather thanRes.string.fooas we've discussed in the past🤖 AI description:
Fixes every existing violation of the import rule: 26 imports across 12 files. The rule itself and the ktlint check that enforces it are in the PR above, so this one is only hand-written source changes and can be read on its own.
The rule being applied. Import the type, never the namespace. An import may shorten a qualified reference only when the short name still says what it is to someone reading that line cold.
HomeUiState.Successpasses.Res.stringandClock.Systemdo not:string.FOOnames nothing, andSystem.now()reads asjava.lang.System.One was a latent bug rather than style. In
TopAppBar.ktthe identifierwindowInsetsmeant two different things depending on where you read it. Three functions declare awindowInsets: WindowInsets = TopAppBarDefaults.windowInsetsparameter and use it, so there the name is the parameter.TopAppBarLayoutForActionshas no such parameter, so its barewindowInsetssilently resolved to the file-levelimport ...TopAppBarDefaults.windowInsetsinstead, and only the compiler surfaced it once that import was gone.No tooling catches this: the import is legitimately used at that one site, so
no-unused-importsis right to stay quiet. It is exactly the readability failure the rule is about, since the same short name resolves to different things in one file.For the 19 design system
Defaultsmembers the owning object lives in the same file, so they are now qualified asTooltipDefaults.defaultStyle, matching whatTopAppBar.ktalready did. References from inside an owning object's own body are untouched, since they resolve without an import.ktlintCheckand./gradlew lintboth pass, and the touched modules compile.Worth knowing for anyone repeating this kind of qualification: it has to cover lowercase resource names too, since
string.general_close_buttonstops resolving once theRes.stringimport goes. ktlint cannot catch that, because it never compiles. Only a build does.