Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3 not marking deprecated methods anymore

I've noticed after the update to Android Studio 3 (but it could be happened also before and I didn't noticed) that some deprecated methods are not marked any more with a line-through. For example:

Code screenshot

I'm on Ubuntu, Android Studio 3.0.1 just updated. I checked inspections in the settings, and it's all enabled. I also checked that the code style/formatting is correctly set-up for deprecations (but it had to be, given the last line of the example is correctly marked). It's not something project-related, since I tried on a freshly created project.

What can cause this?

like image 588
lorenzo-s Avatar asked Nov 21 '17 10:11

lorenzo-s


People also ask

Do deprecated methods still work in Android Studio?

What happens if i continue using Deprecated methods? Code would continue running as it is until method is removed from SDK. If you are using deprecated method then you must keep track of removed apis whenever you upgrade to newest SDK.

Do deprecated methods still work?

A deprecated class or method is like that. It is no longer important. It is so unimportant, in fact, that you should no longer use it since it has been superseded and may cease to exist in the future.

Is it OK to use deprecated methods Android?

Never use deprecated fields, methods, or classes in new code. Java provides an @deprecated annotation to indicate the deprecation of specific fields, methods, and classes. For example, many methods of java.

Does deprecated code work?

Deprecation, in its programming sense, is the process of taking older code and marking it as no longer being useful within the codebase, usually because it has been superseded by newer code. The deprecated code is not immediately removed from the codebase because doing so may cause regression errors.


1 Answers

I finally discovered that this is (strangely) the intended behaviour: https://issuetracker.google.com/65793314

What's your minSdkVersion? It's a feature that we now only show deprecated method calls as deprecated if they're deprecated for all the versions you're trying to target

So, getColor() and isAnimationCacheEnabled() are not marked in my example because I'm targeting API 15+, and instead they're deprecated as of API 23. I confirmed this raising my app's minSdkVersion to 23, and they are all marked now.

Anyway I find this behaviour confusing and unnecessary, like I said in the bug report. If someone read this and agrees, please leave a comment there.

like image 111
lorenzo-s Avatar answered Sep 27 '22 18:09

lorenzo-s