IntelliJ gives useful functionality to see all usages of a method, and to check for usages before delete.
Is there a way to delete all usages of a method?
File -> Preferences -> Editor -> Inlay Hints -> Code vision and uncheck "Usages" for the Intellij folk that get directed here.
In the editor, select a symbol for which you want to see the usages. From the main menu, select Edit | Find Usages | Show Usages In Code Ctrl+Alt+F7 . The usages window shows the current scope and total count of usages. If you want to quickly switch to the default scope, press Ctrl+Alt+F7 .
Press Ctrl+Alt+M or from the main menu, select Refactor | Extract | Method. In the dialog that opens, configure a method options, such as visibility, parameters, and so on. You can also change a name of the method if you need. Click OK.
Safe delete IntelliJ IDEA lets you use the Safe Delete refactoring to remove files and symbols from the source code safely. Before IntelliJ IDEA deletes a file or a symbol, it searches for usages and if they are found, IntelliJ IDEA lets you check them to make necessary adjustments.
Yes you can, but it is not safe. If you are really sure that you want to delete all usages, then you can:
You could seriously break the source code. Safe-deleting Alt+Del is the better solution, that is, iterating through the invocations and deleting them manually.
Even if you empty & inline the method, make sure you first double-check the invocations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With