Skip to content

Commit

Permalink
Fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kameyama committed Feb 16, 2021
1 parent 406a21e commit 0cb50f3
Showing 1 changed file with 18 additions and 1 deletion.
Expand Up @@ -17,16 +17,33 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.isSubclassOf

/**
* Reports unreachable catch blocks.
* Catch blocks can be unreachable if the exception has already been caught in the block above.
*
* <noncompliant>
* fun test() {
* try {
* foo()
* } catch (t: Throwable) {
* } catch (e: Exception) { // unreachable
* bar()
* } catch (e: Exception) {
* // Unreachable
* baz()
* }
* }
* </noncompliant>
*
* <compliant>
* fun test() {
* try {
* foo()
* } catch (e: Exception) {
* baz()
* } catch (t: Throwable) {
* bar()
* }
* }
* </compliant>
*
* @requiresTypeResolution
*/
class UnreachableCatchBlock(config: Config = Config.empty) : Rule(config) {
Expand Down

0 comments on commit 0cb50f3

Please sign in to comment.