From e94f018e14873f7501b6bce5af267e688191fc0b Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Fri, 8 Aug 2025 10:28:58 +0200 Subject: [PATCH] Kotlin: Support kotlin Throws annotations. --- java/ql/lib/semmle/code/java/Member.qll | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/java/ql/lib/semmle/code/java/Member.qll b/java/ql/lib/semmle/code/java/Member.qll index 1e814117e9e..7d84dbd379d 100644 --- a/java/ql/lib/semmle/code/java/Member.qll +++ b/java/ql/lib/semmle/code/java/Member.qll @@ -256,7 +256,15 @@ class Callable extends StmtParent, Member, @callable { Exception getAnException() { exceptions(result, _, this) } /** Gets an exception type that occurs in the `throws` clause of this callable. */ - RefType getAThrownExceptionType() { result = this.getAnException().getType() } + RefType getAThrownExceptionType() { + result = this.getAnException().getType() + or + exists(Annotation a | + this.getAnAnnotation() = a and + a.getType().hasQualifiedName("kotlin.jvm", "Throws") and + a.getATypeArrayValue(_) = result + ) + } /** Gets a call site that references this callable. */ Call getAReference() { result.getCallee() = this }