Skip to content

Commit 309961d

Browse files
authored
Merge pull request #2118 from yh-semmle/java-non-sync-override
Java: restrict `java/non-sync-override` to immediate overrides
2 parents b142113 + b37d92a commit 309961d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

change-notes/1.23/analysis-java.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The following changes in version 1.23 affect Java analysis in all applications.
77
| **Query** | **Expected impact** | **Change** |
88
|------------------------------|------------------------|-----------------------------------|
99
| Dereferenced variable may be null (`java/dereferenced-value-may-be-null`) | Fewer false positives | Certain indirect null guards involving two auxiliary variables known to be equal can now be detected. |
10+
| Non-synchronized override of synchronized method (`java/non-sync-override`) | Fewer false positives | Results are now only reported if the immediately overridden method is synchronized. |
1011
| Query built from user-controlled sources (`java/sql-injection`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as SQL expressions sinks. |
1112
| Query built from local-user-controlled sources (`java/sql-injection-local`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as SQL expressions sinks. |
1213
| Query built without neutralizing special characters (`java/concatenated-sql-query`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as SQL expressions sinks. |

java/ql/src/Likely Bugs/Concurrency/NonSynchronizedOverride.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ where
5656
sup.isSynchronized() and
5757
not sub.isSynchronized() and
5858
not delegatingOverride(sub, sup) and
59+
not exists(Method mid | sub.overrides(mid) and mid.overrides(sup)) and
5960
supSrc = sup.getDeclaringType().getSourceDeclaration()
6061
select sub,
6162
"Method '" + sub.getName() + "' overrides a synchronized method in $@ but is not synchronized.",

0 commit comments

Comments
 (0)