Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Use Markdown for this comment
Set severity, which reflects how much the issue affects the use of the product
Change issue status back to 'Assigned'
Pending code changes (auto-populated)
[ID: 84651]
Select items in the list
[ID: 558956]
[ID: 874707]
Set the version(s) of the product affected by this issue (comma-separated list)
Set the version(s) of the product in which the issue should be fixed (comma-separated list)
Set the version(s) of the product in which the issue fix was verified (comma-separated list)
Set if this issue occurs in production
[ID: 85206]
Set Reporter
Set Type
Set priority, which reflects how soon the issue should be fixed
Set Status
Set Assignee
Set Verifier
Remove item
View or edit staffing
View issue level access limits(Press Alt + Right arrow for more information)
Description
#1DESCRIBE THE ISSUE IN DETAIL:
STEPS TO REPRODUCE:
./gradlew :app:lintDebug
and observe 2 issues;./gradlew :lint-checks:test
and observe tests failing.It looks like
PartialResult#map
doesn't follow the contract in unit tests. It claims to returnLintMap
for the project in context, but under the certain condition it seems to be violated.The conditions require multimodule setup. A
library
module must put smth into itsLintMap
. Then, when theapp
module accesses its ownLintMap
for the first time it get a map prefilled with the data from thelibrary
module, instead of the fresh one.To demonstrate the issue I created the following setup:
:app
module and a:library
module;:app
module containsapp_color
color resource, while:library
module contains:library_color
;color
resource declaration within the module, puts into the partial results and then reports all colors found per module incheckPartialResults
method;If you run lint checks using the
./gradlew :app:lintDebug
command, you'll observe Lint correctly reportingapp_color
found in:app
andlibrary_color
found in:library
. However, if you run the unit tests, you'll observe that Lint also reports alibrary_color
found in the:app
.It looks like while scanning the
:app
module, the first access to partial results, causesLintCliClient
to create new instance of results and fill it with results of the dependent module (seeLintCliClient#getPartialResults
method). For some reason this is happening only in tests.The replacement of the
getPartialResult.map()
method call withgetPartialResult.mapFor(context.project)
method call successfully addresses the issue.There's still a chance, that my test is wrong. In this case, would be great to know in which way.
Studio Build: Chipmunk | 2021.2.1 Version of Gradle Plugin: 7.2.1, 7.4.0-alpha08 Version of Gradle: 7.4.2 OS: Mac OS Monteray 12.4