Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Remove middleman' IntelliJ refactoring on an empty interface

I have an interface which is now empty, and extends another interface. I'd like to remove the empty interface and use the base interface, and am trying to find the correct refactoring in IntelliJ.

I've tried "remove middleman" but got "cannot perform the refactoring. The caret should be positioned at the name of the field to be refactored".

like image 524
ripper234 Avatar asked Nov 05 '09 15:11

ripper234


People also ask

How do I undo refactoring in IntelliJ?

If you need to undo your refactoring, press Ctrl+Z .

What does extract interface mean?

Extracting an interface allows isolating only common interfaces, not common code. In other words, if classes contain Duplicate Code, extracting the interface won't help you to deduplicate.


1 Answers

I think what you want to do is the "inline" refactor on the unwanted interface, e.g.

If

 
class Thing implements ThingA

and

interface ThingA extends ThingB

To get rid of ThingA

you do and inline (ctrl + alt + n) when the caret is on ThingA, you end up with:

class Thing implements ThingB
like image 126
TimT Avatar answered Nov 14 '22 23:11

TimT