IntelliJ is it possible to add @Overrides to all methods of a particular interface?

I have created an interface, with about 30 methods and implemented in 30 classes.

I want to add @Override to each of the implementations, but i would like not to do it by hand.

How can IntelliJ help me?

interface looks like this:

public interface PreviewObjectTests {
    void testGetName();
    void testGetType();
    //... 30 similar methods
}

implementation code:

public class PreviewObjectAccountTest implements PreviewObjectTests {

    //I want to add @Override here!
    @Test public void testGetName() {
        assertThat(...);
    }

    //I want to add @Override here!
    @Test public void testGetType() {
        assertThat(...);
    }

    //...30 similar methods 

}

Solution 1:

Easily done with Alt+Enter intention, then press Right arrow for the sub-menu:

Fix all

Solution 2:

For IntelliJ:

  1. Check if you have "Missing @Override annotation" checked inside Preferences -> Project Settings -> Inspections -> Inheritance issues.
  2. Use Analyze -> Inspect Code
  3. Find Inheritance issues -> Missing @Override annotation inside "Results for Inspection Profile" window.
  4. Apply fix "Add @Override annotation" Apply fix "Add @Override annotation"