Skip to content

Commit c091fc5

Browse files
committed
Java: Account for AssertionError possibly not being extracted.
1 parent 326f2b0 commit c091fc5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

java/ql/lib/semmle/code/java/ControlFlowGraph.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,17 @@ private module ControlFlowGraphImpl {
347347
)
348348
}
349349

350-
private ThrowableType assertionError() { result.hasQualifiedName("java.lang", "AssertionError") }
350+
private ThrowableType actualAssertionError() {
351+
result.hasQualifiedName("java.lang", "AssertionError")
352+
}
353+
354+
private ThrowableType assertionError() {
355+
result = actualAssertionError()
356+
or
357+
// In case `AssertionError` is not extracted, we use `Error` as a fallback.
358+
not exists(actualAssertionError()) and
359+
result.hasQualifiedName("java.lang", "Error")
360+
}
351361

352362
/**
353363
* Gets an exception type that may be thrown during execution of the

0 commit comments

Comments
 (0)