Search code examples
javaintellij-ideakeyboard-shortcutsgetter-setter

Is there a way to find setter method by its getter method or vice versa in a class?


Sometimes related getter and setter methods are not near or under each other in massive classes and finding a setter using its corresponding getter method isn't handy. I know I can select the rest of the method name except the get or set letters from the beginning and hit the Ctrl+F3. Is there a quicker way?


Solution

  • I would use Structure (Alt+7) panel with active features "Show properties" (P icon), "Autoscroll from source" and "Autoscroll to source". If you on setter, getter or field and pressed Alt+7, you will be placed on the parameter and then could be easily switch between them with arrows up and down.enter image description here