r/androiddev • u/ComfortablyBalanced You will pry XML Views from my cold dead hands • Feb 24 '21
Discussion Android Deprecated Annotation is deprecated.

According to Official Android Documentation Deprecated itself is deprecated in API level S. So what's the replacement for Deprecated which itself is deprecated?
55
u/gold_rush_doom Feb 24 '21
I'm guessing it will be moved to the androidx annotations library.
77
u/ComfortablyBalanced You will pry XML Views from my cold dead hands Feb 24 '21
Yeah, let's rename it to androidx.DeprecatedCompat then.
59
12
Feb 24 '21
No, that's preserved for all the Compat stuff that was deprecated but is still maintained!
4
u/AD-LB Feb 24 '21
So what should be used instead? Why for almost all cases I see this annotation, there is no clue about what to use, and how...
1
u/sandeep_r_89 Feb 25 '21
They usually include some alternative in the javadoc. Or maybe it was written about in a blog post/Android dev website.
1
u/AD-LB Feb 25 '21
I'm talking about Android development. Many times there, there is no proper explanation (or even a clue/mention) of what to use instead.
In the beginning I tried to go deep into docs, and most of the times I didn't see anything, so today I go directly to StackOverflow and Google-search instead.
5
1
1
u/alanviverette Android Feb 26 '21
I mean, it would be nice to get a Java port of the
@kotlin.Deprecatedannotation'sreplaceWithfunctionality.
9
u/motivateddeveloper Feb 24 '21
Look how the turntables
3
u/ComfortablyBalanced You will pry XML Views from my cold dead hands Feb 24 '21
Well well well well well well!
19
u/nic0lette Android DevRel Feb 24 '21
Yeah, it's kind of a funny story...
19
10
Feb 24 '21
hold up, so it's not deprecated then?
8
u/sirmonko Feb 24 '21
the depreciation of the depreciation has been depreciated.
1
u/sandeep_r_89 Feb 25 '21
So, does that mean my car value appreciates when we roll it off the dealer's lot?
3
u/sirmonko Feb 25 '21
this actually happened with certain cars for some time. the dacia sold used for more than new, because they were sold out and still cheaper than other cars.
another upside was that they didn't run on Android and were thus safe from depreciation.
33
26
u/can_i_have Feb 24 '21
The Deprecated APIs will now get an obscure warning email every time they are used. By a bot. It'll warn them that they're doing something undesirable but will not exactly tell what. This counts as a strike. The appeals process will be there. It'll be obscure too but in a worse worse way.
Upon three, or a random lesser no of, such strikes, their accounts will be banned and all the other methods in the same class get banned too. Just because.
10
8
7
8
16
u/Tolriq Feb 24 '21
They now directly remove things no need to care about devs :)
6
u/sammndl01 Feb 24 '21
Lol like they did care when after the introduction of Marshmallow, we had to use content instead of file to save something on external storage. Could've kept it and saved us Java programmers hours of searching on stackoverflow and increasing boilerplate code.
7
u/DrSheldonLCooperPhD Feb 24 '21
Glad I am not the only one who feel this way.
Android development right now is unnecessary refactors, alpha dump, Google search ads for developer tools and Android Studio scores based on libraries you are using. I bet even serious Google apps don't use them.
Must really suck to be a new comer to Android dev today.
1
u/ballzak69 Feb 25 '21 edited Feb 25 '21
Indeed, see: https://issuetracker.google.com/issues/128553845
6
u/TotesMessenger Feb 24 '21
3
4
3
u/khsh01 Feb 24 '21
It's funny how this is completely normal for Android developers. In any other context this would be taken as a joke.
3
u/AD-LB Feb 24 '21
This means nothing will be deprecated anymore, as it shouldn't have a deprecation annotation!
:)
26
Feb 24 '21
[removed] — view removed comment
10
u/AD-LB Feb 24 '21
Or better: nothing should be marked as deprecated anymore, because it's deprecated.
77
u/tnorbye Android Studio Team Feb 24 '21
It's not deprecated!
This was a mistake in the platform build tooling (and yes, it's my fault, it's a bug in code I wrote -- https://android.googlesource.com/platform/tools/metalava/+/957c774b622d06b29c4c59e48db59e2e7f2ae734/src/main/java/com/android/tools/metalava/model/psi/PsiModifierItem.kt#230). This also picks up mentions of @deprecated in things like {@code} blocks which it should not. This bug has gone undetected for years... For now it's solved by using escapes to trick metalava into not recognizing @deprecated, but the proper fix will be to properly tokenize the javadoc (which we do in some other places to resolve relative imports for example.)