mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #10859 from tamasvajk/kotlin-field-masking
Kotlin: Exclude fields of live literals from `java/field-masks-super-field`
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
import java
|
||||
private import semmle.code.java.frameworks.android.Compose
|
||||
|
||||
class VisibleInstanceField extends Field {
|
||||
VisibleInstanceField() {
|
||||
@@ -28,6 +29,8 @@ where
|
||||
masked.getName() = masking.getName() and
|
||||
// Exclude intentional masking.
|
||||
not exists(VarAccess va | va.getVariable() = masked | va.getQualifier() instanceof SuperAccess) and
|
||||
type.fromSource()
|
||||
type.fromSource() and
|
||||
// Exclude live literal variables, which is generated code.
|
||||
not masking.getInitializer() instanceof LiveLiteral
|
||||
select masking, "This field shadows another field called $@ in a superclass.", masked,
|
||||
masked.getName()
|
||||
|
||||
Reference in New Issue
Block a user