-
Couldn't load subscription status.
- Fork 29.4k
Open
flutter/packages
#10274Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
In switching video_player_android to the Kotlin generator instead of the Java generator, I got the following lint failure in CI:
[...]/Messages.kt:58: Error: containsKey is defined both as a member in class kotlin.collections.Map and an extension in package kotlin.collections. The defined behavior for this is to use the member, but since the extension is explicitly imported into this file, there's a chance that this was not expected. (One common way this happens is for members to be added to a class after code was already written to use an extension). [MemberExtensionConflict]
a.all { (b as Map<Any?, Any?>).containsKey(it.key) && deepEquals(it.value, b[it.key]) }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation for issues of type "MemberExtensionConflict":
When both member and extension declarations are applicable, the resolution
takes the member. This also implies that, if an extension existed first,
but then a member is added later, the same call-site may end up with
different call resolutions depending on target environment. This results in
a potential runtime exception if the generated binary (library or app)
targets earlier environment (i.e., without the new member, but only
extension). More concrete example is found at:
https://issuetracker.google.com/issues/350432371
The error says "since the extension is explicitly imported into this file", but I don't see that being true here, so I think that part is misleading unless I'm missing something. I was able to avoid the issue by replacing containsKey with contains, which despite the less clear name does the same thing.
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team