@holothuroid and if you watch how IntelliJ does it — especially where it fails — you might get to the same conclusion as me, that IntelliJ mostly just uses templates and string-replacement.
Look at extract method when it fails: it’s basically a template copy at a guessed location with visible inputs as template arguments.
Most of the things it does would even be pretty easy to replicate with Emacs, but they made their approaches so robust that they work 99% of the time.
@karabaic @Mer__edith