How to generate the method stubs for all un-implemented methods in interfaces/abstract classes using eclipse?

StackOverflow https://stackoverflow.com/questions/23358879

  •  11-07-2023
  •  | 
  •  

Question

In eclipse I have the following problem very often while writing java code: While coding (especially in the early time of coding) I often have to change interfaces until everything fits well. If I change such a Superclass I have to modify every single Subclass to implement the method.

This is clearly necessary to make the whole code run but I would like to test things without having to code every in a single bit. Further the trick with

  • Opening the class
  • Clicking on the (errorous) class name
  • ressing <Alt>+<1> and selecting Implement all un-initialized methods

takes quite some time when I have to do it many times.

Is there a way to select all related classes and click in the IDE on some magical menu to generate all non-implemneted methods in these classes as stubs?

Was it helpful?

Solution

The problem is not IDE that do not provide the support for such action. But the way your coding looks, that needs to improve.

An alternative for you may bring Java 8 where you can use the default methods implementation for interface.

Then you will no longer have to update child classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top