Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 55812

Summary: Code formatter incorrectly wraps empty return Javadoc tag
Product: [Eclipse Project] JDT Reporter: Albert Lin <albertl_1998>
Component: TextAssignee: Mateusz Matela <mateusz.matela>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: mateusz.matela
Version: 3.0   
Target Milestone: 4.8 M6   
Hardware: All   
OS: All   
Whiteboard: To be verified for 4.8 M6

Description Albert Lin CLA 2004-03-23 20:31:29 EST
Eclipse 3.0M7
Build id: 200402122000

If a method has a Javadoc comment that contains an @return tag that is empty, 
the code formatter incorrectly wraps the following Javadoc tag so that it is 
on the same line as the @return tag.


To duplicate:

In Preferences > Java > Code Formatter, choose the "Java Conventions [built-
in]" code formatting set.  (Actually, to duplicate this bug, you can probably 
use any code formatter setting that has the "Format Comments" setting turned 
on.)

Format the following code snippet:

public class TestClass {

    /**
     * @return
     * @throws NullPointerException
     */
    public int testMethod() throws NullPointerException {
        return 0;
    }
}


The code formatter produces the following reformatted code:

public class TestClass {

    /**
     * @return @throws
     *         NullPointerException
     */
    public int testMethod() throws NullPointerException {
        return 0;
    }
}


Note that the @return tag and the @throws tag are now on the same line.  
Instead, the code formatter should keep the @return tag on its own line.
Comment 1 Dani Megert CLA 2004-03-24 06:29:41 EST

*** This bug has been marked as a duplicate of 51426 ***