-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed `KDOC_WITHOUT_THROWS_TAG` rule when it adds a @throws annotation to the function, which has `throw` inside try-catch block - Added tests, using real exceptions Closes #1718
- Loading branch information
1 parent
7aad856
commit 23fd0cf
Showing
4 changed files
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
...package/src/main/kotlin/com/saveourtool/diktat/kdoc/methods/KdocWithoutThrowsTagTested.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
package test.paragraph2.kdoc.`package`.src.main.kotlin.com.saveourtool.diktat.kdoc.methods | ||
|
||
/** | ||
* @param onSuccess | ||
* @param onFailure | ||
*/ | ||
fun parseInputNumber(onSuccess: (number: Int) -> Unit, onFailure: () -> Unit) { | ||
try { | ||
val input: Int = binding.inputEditText.text.toString().toInt() | ||
if (input < 0) | ||
throw NumberFormatException() | ||
throw ArrayIndexOutOfBounds() | ||
throw NullPointerException() | ||
|
||
onSuccess(input) | ||
} catch (e: NumberFormatException) { | ||
} catch (e: IllegalArgumentException) { | ||
onFailure() | ||
} catch (e: NullPointerException) { | ||
onFailure() | ||
} | ||
} |