Issue
I am trying to use @ChecksSdkIntAtLeast annotation to convert our java utility functions into kotlin properties that would not require @SuppressLint("NewApi")
.
But anyway I write the property, it stops red underlining code for both branches of if
.
Demo:
@get:ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
val isAtLeastOreo: Boolean
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
manager.getNotificationChannel("general")
} else {
manager.getNotificationChannel("general") // CORRECTLY UNDERLINED
}
if (isAtLeastOreo) {
manager.getNotificationChannel("general")
} else {
manager.getNotificationChannel("general") // NOT UNDERLINED - WHY??
}
Same thing happens if I make it into function instead of getter. The only working one would be using lambda, but then I am losing if-else construct and would require massive amount of places to refactor.
Solution
Issue has been reported on Aug 23. Waiting for response
https://issuetracker.google.com/issues/197428342
Answered By - Majkeee
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.