views:

95

answers:

2

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".

+2  A: 

I think that what you're looking for is the "Type Migration" refactoring.

Hugo Palma
Not working - I still get "The caret should be positioned..." error.
ripper234
Where are you applying the refactor ? This refactor has to be applied in the class of the field declaration. So if you have:A extends B....private A myField;you can only apply this refactoring on A in the field declaration line.
Hugo Palma
+1  A: 

Looking at a blog post explaining the "Remove Middleman" refactoring in IDEA, I'd think you simply cannot use it for this. It's just for "replacing all calls to delegating methods with the equivalent direct calls".

(For a moment I thought another refactoring, "Use Interface Where Possible", might be of help, but I couldn't get that working either in my simple test case.)

Jonik