https://kotlinlang.org logo
#getting-started
Title
# getting-started
j

juh juh

07/31/2022, 8:27 PM
Is there a way to mark an interface method, so the IDE would show a warning when calling it, unless suppressed?
m

MR3Y

07/31/2022, 8:43 PM
-you can write a custom rule with whatever linter you're using -Or use @RequiresOptIn https://kotlinlang.org/docs/opt-in-requirements.html
v

Vampire

07/31/2022, 8:44 PM
Or deprecate it
3
j

Joffrey

07/31/2022, 9:16 PM
Use the opt-in mechanism if the method has reasons to be used in some cases but you want users to consciously opt in because there are implications. Use the deprecation mechanism if there is no reason to use this method ever.
👍 2
j

juh juh

08/01/2022, 1:50 PM
Thanks! Opt-in is just what I need!
👌 1
2 Views