Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to "deprecate" a library method in IntelliJ?

We have a third-party library method which is overloaded to accept one or more arguments. We found that using the single parameter variation is problematic and want IntelliJ to warn the user when that variation is being used. Does anyone know how to set up this code inspection rule?

like image 484
Tom Avatar asked Oct 13 '15 17:10

Tom


People also ask

How do you make a method deprecated?

Using the @Deprecated Annotation To use it, you simply precede the class, method, or member declaration with "@Deprecated." Using the @Deprecated annotation to deprecate a class, method, or field ensures that all compilers will issue warnings when code uses that program element.

How do you make a method deprecated in Java?

Use both @Deprecated annotation and the @deprecated JavaDoc tag. The @deprecated JavaDoc tag is used for documentation purposes. The @Deprecated annotation instructs the compiler that the method is deprecated.

What is deprecated library?

A deprecated library is a library without any support. It also means that as other libraries improve (such as the rails framework), they will become incompatible with the deprecated library. If you are trying to stay current with those libraries, you might be forced to migrate to the new version.


1 Answers

Use the Structural Search Inspection. You can copy the existing method calls templates and modify it for your needs. This way you get a warning in the editor the moment the unwanted method call it written.

like image 117
Bas Leijdekkers Avatar answered Oct 28 '22 20:10

Bas Leijdekkers