Often times I know what method to use but not what overload of that method. Is there a quick way to show all overloads of a method in Intellij?
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 .
Overloading happens when you have two methods with the same name but different signatures (or arguments). In a class we can implement two or more methods with the same name.
In IDEA, clicks on the method name, press CTRL + Q to show the method signature on a pop up. Alternatively, press CTRL + P to show the available parameters.
The compiler distinguishes overloaded methods by their signatures—a combination of the method's name and the number, types and order of its parameters, but not its return type. If the compiler looked only at method names during compilation, the code in Fig.
Just use Code Completion Cmd/Ctrl+Space?
It is also possible to show overloaded constructors by enabling a hidden option. Invoke the Help | Find Action
menu item and type Registry
to go to the Registry. Here enable the java.completion.show.constructors
option.
When you already have the complete method or constructor name, and just want to know which parameters it and its overloads accepts, use View | Parameter Info
Cmd/Ctrl+P.
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