Skip to content

Commit e94f018

Browse files
committed
Kotlin: Support kotlin Throws annotations.
1 parent 3b3f4bc commit e94f018

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,15 @@ class Callable extends StmtParent, Member, @callable {
256256
Exception getAnException() { exceptions(result, _, this) }
257257

258258
/** Gets an exception type that occurs in the `throws` clause of this callable. */
259-
RefType getAThrownExceptionType() { result = this.getAnException().getType() }
259+
RefType getAThrownExceptionType() {
260+
result = this.getAnException().getType()
261+
or
262+
exists(Annotation a |
263+
this.getAnAnnotation() = a and
264+
a.getType().hasQualifiedName("kotlin.jvm", "Throws") and
265+
a.getATypeArrayValue(_) = result
266+
)
267+
}
260268

261269
/** Gets a call site that references this callable. */
262270
Call getAReference() { result.getCallee() = this }

0 commit comments

Comments
 (0)