Questions tagged [deprecated]

Deprecation is a status applied to software features or language terms to indicate that they should be avoided, typically because they have been superseded. Use this tag for questions about deprecated features or how to deprecate features yourself (e.g. using annotations).

In the process of authoring computer software, its standards or documentation, deprecation is a status applied to software features to indicate that they should be avoided, typically because they have been superseded. Although deprecated features remain in the software, their use may raise warning messages recommending alternative practices, and deprecation may indicate that the feature will be removed in the future.

Features are deprecated—rather than immediately removed—in order to provide backward compatibility and give programmers who have used the feature time to bring their code into compliance with the new standard.

2508 questions
149
votes
5 answers

How do I flag a method as deprecated in Objective-C 2.0?

I'm part of a team developing a fairly large iPad app and there are many different classes we've created as a result. The trouble is some of the methods are now pretty much obsolete and I don't want simply remove them yet as I know some parts of…
Jamie Chapman
  • 4,229
  • 5
  • 29
  • 47
148
votes
11 answers

Best practice to mark deprecated code in Ruby?

I'd like to mark a method as deprecated, so the people using it can easily check their code and catch up. In Java you set @Deprecated and everybody knows what this means. So is there a preferred way (or even tools) to mark and check for deprecations…
blindgaenger
  • 2,030
  • 2
  • 16
  • 10
146
votes
3 answers

Why is Cloneable not deprecated?

It is commonly understood that Cloneable interface in Java is broken. There are many reasons for this, which I will not mention; others already did it. It is also the position of Java architects themselves. My question is therefore: why has is not…
Kao
  • 7,225
  • 9
  • 41
  • 65
139
votes
3 answers

ActionBarActivity is deprecated

Actually there is no problem. Project compiles and runs. But I can't understand what is mean strikeout class name (Android Studio tells that there is deprecated code is used). Can anybody explain?
user4696584
135
votes
7 answers

Suppress deprecated import warning in Java

In Java, if you import a deprecated class: import SomeDeprecatedClass; You get this warning: The type SomeDeprecatedClass is deprecated Is there a way to suppress this warning?
Ed Mazur
  • 3,042
  • 3
  • 21
  • 21
122
votes
3 answers

Why was ActionBarActivity deprecated

I installed Android Studio freshly and I begun coding an activity to extend ActionBarActivity and it showed that it was deprecated. So how else do I set up an actionbar for my activity. Also the Getting Started Training uses the ActionBarActivity…
117
votes
8 answers

Replacement for stringByAddingPercentEscapesUsingEncoding in ios9?

In iOS8 and prior I can use: NSString *str = ...; // some URL NSString *result = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; in iOS9 stringByAddingPercentEscapesUsingEncoding has been replaced with…
slavik
  • 1,341
  • 2
  • 11
  • 16
117
votes
5 answers

Python's many ways of string formatting — are the older ones (going to be) deprecated?

Python has at least six ways of formatting a string: In [1]: world = "Earth" # method 1a In [2]: "Hello, %s" % world Out[2]: 'Hello, Earth' # method 1b In [3]: "Hello, %(planet)s" % {"planet": world} Out[3]: 'Hello, Earth' # method 2a In [4]:…
gerrit
  • 24,025
  • 17
  • 97
  • 170
116
votes
3 answers

Deprecated ManagedQuery() issue

I have this method: public String getRealPathFromURI(Uri contentUri) { String[] proj = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(contentUri, proj, null, null, null); int column_index =…
AndreaF
  • 11,975
  • 27
  • 102
  • 168
113
votes
6 answers

FacebookSdk.sdkInitialize (Context) is deprecated

I'm using facebook-android-sdk-4.19.0 in Android Studio and I followed the Facebook quick start guide at https://developers.facebook.com/docs/android/getting-started (Click on the Quick Start button to sign in with your own facebook account). In the…
Ozan
  • 1,381
  • 2
  • 10
  • 13
107
votes
10 answers

setBackgroundDrawable() deprecated

So my sdk goes from 15 to 21 and when I call setBackgroundDrawable(), Android Studio tells me that it's deprecated. I thought of going around it using: int sdk = android.os.Build.VERSION.SDK_INT; if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN)…
Makoto
  • 1,455
  • 4
  • 13
  • 17
105
votes
11 answers

How exactly to use Notification.Builder

I found that I am using a deprecated method for noficitations (notification.setLatestEventInfo()) It says to use Notification.Builder. How do I use it? When I try to create a new instance, it tells me: Notification.Builder cannot be resolved to a…
Saariko
  • 1,703
  • 4
  • 26
  • 46
104
votes
12 answers

Deprecated: mysql_connect()

I am getting this warning, but the program still runs correctly. The MySQL code is showing me a message in PHP: Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in …
Mubashar Ahmed Hassan
  • 1,179
  • 3
  • 10
  • 16
93
votes
9 answers

DeprecationWarning: collection.findAndModify is deprecated. Use findOneAndUpdate, findOneAndReplace or findOneAndDelete instead?

I am using mongoose findOneAndUpdate but still getting the error, DeprecationWarning: collection.findAndModify is deprecated. Use findOneAndUpdate, findOneAndReplace or findOneAndDelete instead. But I am not even using findAndModify, why is it…
Sudhanshu Gaur
  • 7,486
  • 9
  • 47
  • 94
92
votes
10 answers

Android - onRequestPermissionsResult() is deprecated. Are there any alternatives?

I tried to implement request permissions for writing and reading from storage. Everything worked good but today Android showed me that the method onRequestPermissionsResult(...) is deprecated. There are so many questions about this topic in…
ashley
  • 921
  • 1
  • 4
  • 4