mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Kotlin: Exclude .kt files from java/unreachable-catch-clause
This commit is contained in:
@@ -86,6 +86,7 @@ predicate overlappingExceptions(RefType e1, RefType e2) {
|
||||
|
||||
from TryStmt try, int first, int second, RefType masking, RefType masked, string multiCatchMsg
|
||||
where
|
||||
try.getFile().isJavaSourceFile() and
|
||||
masking = caughtType(try, first) and
|
||||
masking.getAStrictAncestor() = masked and
|
||||
masked = caughtType(try, second) and
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
| PartiallyMaskedCatchTest.kt:18:7:20:5 | catch (...) | This catch-clause is unreachable; it is masked $@. | PartiallyMaskedCatchTest.kt:16:7:18:5 | catch (...) | by a previous catch-clause for exceptions of type 'FileNotFoundException' |
|
||||
| PartiallyMaskedCatchTest.kt:28:7:30:5 | catch (...) | This catch-clause is unreachable; it is masked $@. | PartiallyMaskedCatchTest.kt:26:7:28:5 | catch (...) | by a previous catch-clause for exceptions of type 'FileNotFoundException' |
|
||||
|
||||
@@ -15,7 +15,7 @@ fun fn2() {
|
||||
fn0()
|
||||
} catch (e: java.io.FileNotFoundException) {
|
||||
println(e)
|
||||
} catch (e: java.io.IOException) { // False positive
|
||||
} catch (e: java.io.IOException) {
|
||||
println(e)
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ fun fn3() {
|
||||
throw java.io.FileNotFoundException()
|
||||
} catch (e: java.io.FileNotFoundException) {
|
||||
println(e)
|
||||
} catch (e: java.io.IOException) { // True positive
|
||||
} catch (e: java.io.IOException) { // TODO: False negative
|
||||
println(e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user