Add method to interface

Is there a refactor available that if I add a method to a interface, a stub for the method will automatically added to all implementers? It would save a lot of tediousness if there was. Nothing is jumping out at me in the refactor menu as providing that.

Will open a feature request if it doesn't already exist.

3 comments

Could you please provide a use-case where it would make sense to only
dummy-implement it? IMHO this is very limited and nearly all you have to
take a look at the implementing class and implement a special implementation.

0

Use case for it is very common. I have an interface that has numerous implementers. I add a method to the interface. Now I have to manually go to each implementer and add a stub so my code at least still compiles until I can add a true implementation to every implementor.

There is an intention that lets you add it to an implementor, but you have to do it for each implementing class rather than just being able to select something like "add to all".

(the other option is to create an adapter class)

0

Yes, that's what I understood, but I don't see that it would be useful to
just add a lot of dummy implementations. Maybe using an abstract class would
be more appropriate instead of using an interface.

0

Please sign in to leave a comment.