1

Before JDK 8 I would write: A implements B and hit alt+enter to automatically generate the method headers for the methods in B so I only have to fill in the method bodies.

However in JDK 8 it is possible that B provides a default implementation and this doesn't work anymore.

How can I still generate the code in this case?

I'm using IntelliJ IDEA 12.

2
  • 1
    have you tried ALT+Insert --> Implement Methods / Override Methods? Commented Jul 1, 2013 at 22:58
  • @damo That works! Feel free to add it as an answer and I'll accept it :) Commented Jul 1, 2013 at 23:06

3 Answers 3

4

Alt+Enter is just a shortcut to bring up IDEA's suggested solutions. In your case, it's just a quick way to get to Code|Implement Methods... or Code|Override Methods...

You can also get to these menus via the Generate menu: Alt+Insert

Or directly via their respective keymaps: Ctrl+O(override) and Ctrl+I(implement)

Sign up to request clarification or add additional context in comments.

Comments

0

Also, if you are on OSX you can use Ctrl ^ + i. There you'll have all the default methods available to implement from the interfaces defined in your class. Methods available when implement WebMvcConfigurer in IntelliJ IDEA

Comments

0

For Windows I wasn't getting the proper suggestions with Alt+Enter

What worked for me was the shortcut Ctrl+I

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.