mirror of
https://github.com/github/codeql.git
synced 2026-02-27 20:33:42 +01:00
Java: Consolidate Assertions.qll and Preconditions.qll.
This commit is contained in:
@@ -365,10 +365,10 @@ private module ControlFlowGraphImpl {
|
||||
* Bind `t` to an unchecked exception that may occur in a precondition check or guard wrapper.
|
||||
*/
|
||||
private predicate uncheckedExceptionFromMethod(MethodCall ma, ThrowableType t) {
|
||||
conditionCheckArgument(ma, _, _) and
|
||||
(methodCallChecksArgument(ma) or methodCallUnconditionallyThrows(ma)) and
|
||||
(t instanceof TypeError or t instanceof TypeRuntimeException)
|
||||
or
|
||||
methodMayThrow(ma.getMethod(), t)
|
||||
methodMayThrow(ma.getMethod().getSourceDeclaration(), t)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -586,6 +586,7 @@ private module ControlFlowGraphImpl {
|
||||
* Gets a `MethodCall` that always throws an exception or calls `exit`.
|
||||
*/
|
||||
private MethodCall nonReturningMethodCall() {
|
||||
methodCallUnconditionallyThrows(result) or
|
||||
result.getMethod().getSourceDeclaration() = nonReturningMethod() or
|
||||
result = likelyNonReturningMethod().getAnAccess()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user