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

Skip to content

Commit 6d59b4e

Browse files
committed
Java 12: tweak queries to preserve behavior
This accounts for the changes in af8faee1.
1 parent de47f25 commit 6d59b4e

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
import java
1515

16-
/** A `synchronized` method or statement. */
17-
class Synched extends StmtParent {
16+
/** A `synchronized` method body or statement. */
17+
class Synched extends Stmt {
1818
Synched() {
19-
this.(Method).isSynchronized() or
19+
this.getParent().(Method).isSynchronized() or
2020
this instanceof SynchronizedStmt
2121
}
2222
}

java/ql/src/Security/CWE/CWE-833/LockOrderInconsistency.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ class Synched extends Top {
4646
or
4747
result = this.(SynchronizedStmt).getAChild+()
4848
or
49-
exists(MethodAccess ma | ma = result | ma.getEnclosingStmt().getEnclosingStmt*() = this)
49+
exists(MethodAccess ma | ma = result |
50+
ma.getEnclosingStmt().getEnclosingStmt*() = this or ma.getEnclosingCallable() = this
51+
)
5052
}
5153

5254
/** The variable on which synchronization is performed, provided this element is a `SynchronizedStmt`. */

0 commit comments

Comments
 (0)