Kotlin: Exclude variables of live literals from java/field-masks-super-field

This commit is contained in:
Tamas Vajk
2022-10-17 15:07:39 +02:00
parent 122d188f1d
commit 21c13fb9a3

View File

@@ -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 exists(LiveLiteral l | masking.getInitializer() = l)
select masking, "This field shadows another field called $@ in a superclass.", masked,
masked.getName()