AutoRefactor icon indicating copy to clipboard operation
AutoRefactor copied to clipboard

Attach line comments on fields to existing javadocs

Open JnRouvignac opened this issue 9 years ago • 1 comments

Given

The following code:

/** javadoc **/
private static final String REGEX = ".*"; // line comment 1

// line comment 2
private static final String FIELD = "bla";

When

automated refactoring are applied

Then

Expected:

/**
 * javadoc
 * line comment 1
 */
private static final String REGEX = ".*";

/** line comment 2 */
private static final String FIELD = "bla";

Actual:

/** Javadoc. */
private static final String REGEX = ".*"; /** Line comment 1 line comment 2. */
private static final String FIELD = "bla";

Note how "line comment 1" is attached to the existing javadoc rather than added as a javadoc of FIELD.

JnRouvignac avatar Feb 23 '16 15:02 JnRouvignac

Also test what happens when javadoc is replaced by a block comment in the example above, i.e.:

    /* block comment **/
    private static final String REGEX = ".*"; // line comment 1

    // line comment 2
    private static final String FIELD = "bla";

JnRouvignac avatar Feb 23 '16 15:02 JnRouvignac