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
62
votes
4 answers

Is it safe to use .getWidth on Display even though its deprecated

So i have a small problem, i'm writing a function which need to send screen width to server. I got it all to work, and i use: Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); to get width. However…
gabrjan
  • 3,080
  • 9
  • 40
  • 69
61
votes
3 answers

How does the functools cmp_to_key function work?

In Python, both list.sort method and sorted built-in function accepts an optional parameter named key, which is a function that, given an element from the list returns its sorting key. Older Python versions used a different approach using the cmp…
matiascelasco
  • 1,145
  • 2
  • 13
  • 18
60
votes
3 answers

Deprecated conversion from string literal to 'char*'

I have a program which declares an array of strings like this: char *colors[4] = {"red", "orange", "yellow", "blue"}; But I get the above compiler warning. It compiles but I'd rather use the non-deprecated way(if there is one). I've tried to find…
Matt
  • 715
  • 1
  • 5
  • 6
60
votes
2 answers

PHP 7.4 deprecated get_magic_quotes_gpc function alternative

I am encountered with the situation where one of my old code is using get_magic_quotes_gpc() which is deprecated in the latest PHP version 7.4.* Currently, I have something like this. Add Slashes return get_magic_quotes_gpc() ? addslashes($string) :…
Code Lover
  • 8,099
  • 20
  • 84
  • 154
59
votes
12 answers

Migration to PHP 8.1 - how to fix Deprecated Passing null to parameter error - rename build in functions

PHP 8.1 has deprecated passing null as parameters to a lot of core functions. My main problem is with functions like htmlspecialchars(php) and trim(php), where null no longer is silently converted to the empty string. To fix this issue without going…
Janis T
  • 693
  • 1
  • 3
  • 5
59
votes
2 answers

Why is the DOMSubtreeModified event deprecated in DOM level 3?

Why is the DOMSubtreeModified event deprecated and what are we supposed to use instead?
huyz
  • 2,297
  • 3
  • 25
  • 34
59
votes
1 answer

Intellij Idea find all deprecated usages in the project

I upgrade a language level in IntelliJ Idea in a quite big project and I would like to find all deprecated method usages left - I look for all the striketrough occurrences. I have found a similar question for PhpStorm where is suggested an…
Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
59
votes
6 answers

Why was "new Date(int year, int month, int day)" deprecated?

My application I've recently inherited is FULL of deprecation warnings about the constructor: Date d = new Date(int year, int month, int day) Does anyone know or can point to a reason why something as simple as this was "replaced" with something…
Scott Bennett-McLeish
  • 9,187
  • 11
  • 41
  • 47
59
votes
3 answers

setTextAppearance deprecated in API level 23

public void setTextAppearance (Context context, int resId) Added in API level 1 This method was deprecated in API level 23. Use setTextAppearance(int) instead. My Question: Why it's been deprecated? Why it doesn't need Context anymore? And…
Alireza Farahani
  • 2,238
  • 3
  • 30
  • 54
58
votes
12 answers

Springs XmlBeanFactory is deprecated

I try to learn Spring. I am following this site http://www.roseindia.net/spring/spring3/spring-3-hello-world.shtml I tried one example in that. I am using some what like below, but here it shows: The type XmlBeanFactory is deprecated What do I…
Vishwanath.M
  • 6,235
  • 11
  • 42
  • 56
58
votes
4 answers

How can I fix the "UIPopoverController is deprecated" warning?

I am using this code: mediaLibraryPopover = [[UIPopoverController alloc] initWithContentViewController:avc]; [self.mediaLibraryPopover presentPopoverFromRect:[theButton bounds] inView:theButton …
Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
57
votes
5 answers

Why are std::shuffle methods being deprecated in C++14?

According to the cppreference.com reference site on std::shufle, the following method is being deprecated in c++14: template< class RandomIt > void random_shuffle( RandomIt first, RandomIt last ); Why will we no longer be able to call the following…
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
56
votes
1 answer

Why is std::aligned_storage to be deprecated in C++23 and what to use instead?

I just saw that C++23 plans to deprecate both std::aligned_storage and std::aligned_storage_t as well as std::aligned_union and std::aligned_union_t. Placement new'd objects in aligned storage are not particularly constexpr friendly as far as I…
bitmask
  • 32,434
  • 14
  • 99
  • 159
56
votes
9 answers

Getting screen width on API Level 30 (Android 11): getDefaultDisplay() and getMetrics() are now deprecated. What should we use instead?

I currently calculate the screen width like this : public static int getScreenWidth(@NonNull Context context) { DisplayMetrics displayMetrics = new DisplayMetrics(); ((Activity)…
Greelings
  • 4,964
  • 7
  • 34
  • 70
56
votes
2 answers

What to do about "The Components object is deprecated. It will soon be removed." in dev tools Console

For almost every page I open in Firefox, I see this error in the Console of the developer tool bar: (!) The Components object is deprecated. It will soon be removed. The source is the html page. It happens with pages I create, but also on many…
R. Schreurs
  • 8,587
  • 5
  • 43
  • 62