Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 505ccbb

Browse files
tamasvajkigfoo
authored andcommitted
Extract override modifier
1 parent 92de139 commit 505ccbb

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,10 @@ open class KotlinFileExtractor(
703703
addModifiers(id, "static")
704704
}
705705

706+
if (f is IrSimpleFunction && f.overriddenSymbols.isNotEmpty()) {
707+
addModifiers(id, "override")
708+
}
709+
706710
return id
707711
}
708712
}

java/ql/src/Advisory/Declarations/MissingOverrideAnnotation.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ from OverridingMethod m, Method overridden
2121
where
2222
m.fromSource() and
2323
m.overrides(overridden) and
24+
not m.hasModifier("override") and
2425
not m.isOverrideAnnotated() and
2526
not exists(FunctionalExpr mref | mref.asMethod() = m)
2627
select m, "This method overrides $@; it is advisable to add an Override annotation.", overridden,
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
| Test.kt:16:14:18:5 | m | This method overrides $@; it is advisable to add an Override annotation. | Test.kt:2:10:4:5 | m | A.m |
2-
| Test.kt:22:14:22:24 | o | This method overrides $@; it is advisable to add an Override annotation. | Test.kt:12:5:12:11 | o | I.o |
3-
| Test.kt:24:14:24:22 | getP | This method overrides $@; it is advisable to add an Override annotation. | Test.kt:8:10:8:18 | getP | A.getP |

0 commit comments

Comments
 (0)