Is it possible to suppress deprecation warnings wi...
# getting-started
j
Is it possible to suppress deprecation warnings without doing it for the entire file? When I try to suppress a usage in a top-level function, it says "redundant suppression" and the import statement still has the deprecation warning.
Copy code
import com.whatever.DeprecatedClass <-- Deprecation warning persists

@Suppress("deprecation") <--- redundant suppression
fun test(value: DeprecatedClass) { ... }
j
Is the suppress string case-sensitive by chance? I've used suppression a like that quite often, but never all-lowercase deprecation
e
afaik the only way to suppress it on the import is to use
@file:Suppress
- it doesn't matter if the usages are suppressed or not
💯 1
j
Oh true, I misread the question, my bad 😅
m
You can supress deprecation warnings by replacing import with FQCN in use-site. (I think it's desing to prevent unintentional use in other location in same file.
j
@Matsuda Kazuki This is a great suggestion. Thank you.