Kotlin/Java: Exclude generated code from java/missing-override-annotation

This commit is contained in:
Tamas Vajk
2022-10-11 15:48:42 +02:00
parent 0883b1782d
commit 9b2cc6c318

View File

@@ -23,6 +23,8 @@ where
m.overrides(overridden) and
not m.hasModifier("override") and
not m.isOverrideAnnotated() and
not exists(FunctionalExpr mref | mref.asMethod() = m)
not exists(FunctionalExpr mref | mref.asMethod() = m) and
// Ignore generated constructs, such as <clinit> functions extracted from Kotlin code:
not m.isCompilerGenerated()
select m, "This method overrides $@; it is advisable to add an Override annotation.", overridden,
overridden.getDeclaringType() + "." + overridden.getName()