Inspectopedia Help

Deprecated API usage

Reports usages of deprecated classes, fields, and methods. A quick-fix is available to automatically convert the deprecated usage, when the necessary information can be extracted from the Javadoc of the deprecated member.

Example:

class Interesting { /** * @deprecated Use {@link #newHotness()} instead */ @Deprecated public void oldAndBusted() {} public void newHotness() {} } class ElseWhere { void x(Interesting i) { i.oldAndBusted(); // deprecated warning here } }

After the quick-fix is applied:

class Interesting { /** * @deprecated Use {@link #newHotness()} instead */ @Deprecated public void oldAndBusted() {} public void newHotness() {} } class ElseWhere { void x(Interesting i) { i.newHotness(); } }

By default, the inspection doesn't produce a warning if it's impossible or hard to avoid it. For example, the following code won't be reported:

abstract class A { //library code @Deprecated abstract void m(); } class B extends A { //project code @Override void m() { //doSmth; } }

Configure the inspection:

Use the options to disable this inspection inside deprecated members, overrides of abstract deprecated methods, non-static import statements, methods of deprecated classes, or same top-level classes.

Inspection options

Option

Type

Default

Ignore inside deprecated members

Checkbox

true

Ignore inside non-static imports

Checkbox

true

Ignore overrides of deprecated abstract methods from non-deprecated supers

Checkbox

true

Ignore members of deprecated classes

Checkbox

true

Ignore in the same outermost class

Checkbox

true

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023