Suraj Shah
06/24/2019, 8:05 AMContract
for deprecation be a good idea?
Take Html.fromHtml
for example, even though we have HtmlCompat
we wont have to go and create a XxxCompat
for everyone if something like this was possible.
Consider this snippet:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(contactToDisplay, Html.FROM_HTML_MODE_LEGACY)
} else {
@Suppress("DEPRECATION") // maybe we can do something to avoid this?
Html.fromHtml(contactToDisplay)
}
If we could wrap this in a contract maybe, plus android SDKs mostly have when a particular api was deprecated, even though below a particular SDK level, it was completely fine using it.
Also, looking at a bigger picture we could maybe not just use primal checks like implies x != null
there could be some other annotation with retention policy of runtime or something and maybe we could do implies x is NotDeprecated::class.java
or something.
Just a thought.itnoles
06/24/2019, 5:28 PMSuraj Shah
06/24/2019, 5:56 PMitnoles
06/24/2019, 6:06 PM