is there any built-in annotation to suppress 'unus...
# announcements
b
is there any built-in annotation to suppress 'unused' warnings for methods in a library? i.e. 'API methods' used by other code. or a good way i could define one?
r
Call them in tests 🧌
âž• 5
c
Or better yet, actually unit-test those methods 😂
b
fair enough, but surely circumstances can exist where that may not always make sense. plus, i thought being explicit could be nice. so...does such an annotation exist?
p
You could add
@file:Suppress("unused")
at the top of the file it will suppress all warnings in that file.
b
thanks paulius. and it's easy to create an 'alias' for an annotation, isn't it? as in, if i wanted to define an annotation that was something like
@PublicAPI
but have it defined as basically
Suppress("unused")
?
p
You can only alias the name
typealias PublicAPI = Suppress
so it would still have to be with an argument
@PublicAPI("unused")
.
b
ah bummer. ok thanks.
k
Didn't know you could typealias annotations like that, that's interesting.