Last active
June 2, 2020 00:28
-
-
Save guilhermekrz/691edfa44ad810cb35b8be6ada7b5690 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
override fun getApplicableUastTypes(): List<Class<out UElement>>? { | |
return listOf(UMethod::class.java, UCallExpression::class.java) | |
} | |
override fun createUastHandler(context: JavaContext): UElementHandler? { | |
return KotlinThrowsHandler(context) | |
} | |
private inner class KotlinThrowsHandler(private val context: JavaContext) : UElementHandler() { | |
override fun visitMethod(node: UMethod) { | |
for(annotation in node.annotations) { | |
if(annotation.qualifiedName == Throws::class.qualifiedName) { | |
reportUsage(context, location = context.getLocation(node = node)) | |
} | |
} | |
} | |
override fun visitCallExpression(node: UCallExpression) { | |
node.accept(ThrowCallVisitor(context)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment