Merge pull request #2118 from yh-semmle/java-non-sync-override

Java: restrict `java/non-sync-override` to immediate overrides
This commit is contained in:
Anders Schack-Mulligen
2019-10-15 16:40:00 +02:00
committed by GitHub
2 changed files with 2 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ where
sup.isSynchronized() and
not sub.isSynchronized() and
not delegatingOverride(sub, sup) and
not exists(Method mid | sub.overrides(mid) and mid.overrides(sup)) and
supSrc = sup.getDeclaringType().getSourceDeclaration()
select sub,
"Method '" + sub.getName() + "' overrides a synchronized method in $@ but is not synchronized.",