Search code examples
javaeclipseidecommentsautocommenting

Eclipse - Java - Auto Commenting (Alt-Shift-J) just adds blank comments


I am trying to add comments to my code. When I highlight a function and press Alt-Shift-J, it just adds three blank lines of commenting:

/**      
 *   
 */     
 protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
        System.out.println("In Gateway doGet...");
        this.doRequest("GET", request, response);   }

NOTE - this is a screenshot of what my preferences looks like: enter image description here

The "${tags} do nothing, but I put in a string for "Title" and it still does nothing. Can someone help me out please?


Solution

  • I am assuming you are extending HttpServletRequest since your doGet method is defined there and you are therefore overriding that method.

    Since you are overriding a method, you need to select Overriding methods in that menu and then enter your comment:

    enter image description here

    With that, Eclipse will fill in the comment.