Overriding a method in Eclipse IDE and (non-Javadoc) comment lines

Do you want to change the comment lines generated by Eclipse when you override a method? Here is how to do it.

Almost everything is configurable in Eclipse. If the default values do not work for your project, you should invest time to tune your IDE. Yesterday a colleague told me about a configuration to change something I found annoying every day: By default, when you override a method in a child class in Eclipse you get something like this:

 

@Order(10.0) 

 

 

public class ViewDetailsButton extends AbstractExtensibleButton { 

 

 

 /* (non-Javadoc)

 

 

 * @see org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton#execClickAction() 

 

 

 */

 

 

 @Override

 

 

 protected void execClickAction() throws ProcessingException { 

 

 

 // TODO Auto-generated method stub 

 

 

 super.execClickAction(); 

 

 

 } 

 

 

} 

 

I never understood why the "(non-Javadoc)" comment lines were generated and I always removed them. This is not really a big deal (moving the cursor, pressing CTRL+D, going back to the method body) and I could live with it. Now that I know that switching off the generation of those line can be configured, I ask myself why I did not did it sooner.

Under preferences, open the "Code Templates" preference page (under the Java code style). Select "Comments > Overriding methods" in the tree and click on the "Edit…" button. In the second Dialog you can edit the pattern.