Skip to content

Instantly share code, notes, and snippets.

@takahirom
Last active March 1, 2022 00:44
Show Gist options
  • Save takahirom/394c902663e1a16be7a6c4e79316ed15 to your computer and use it in GitHub Desktop.
Save takahirom/394c902663e1a16be7a6c4e79316ed15 to your computer and use it in GitHub Desktop.
@RequiresOptIn(message = "AmazingFeature should be checked")
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
annotation class AmazingFeature
@AmazingFeature
fun brokenAmazingFeature() {
TODO("aaaaa")
}
class HogeActivity {
fun onClick() {
brokenAmazingFeature() // Compile-time errors will be displayed!!!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment