Question

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.

Was it helpful?

Solution

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)

OTHER TIPS

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

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