Block Comments: CR lines not handled the same as LF lines #3225

Closed
rnveach opened this Issue May 28, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@rnveach
Member

rnveach commented May 28, 2016

Taken from problems in PR #3179 with file InputNewlineCrAtEndOfFile.java.

/**
 * Test case for detection of an existing CR newline at EOF, using the 
 * NewlineAtEndOfFileCheck.
 * @author Martin Steiger
 **/

when Tree is printed with LF:

|--MODIFIERS -> MODIFIERS [12:0]
|  |--BLOCK_COMMENT_BEGIN -> /* [7:0]
|  |  |--COMMENT_CONTENT -> *\n * Test case for detection of an existing CR newline at EOF, using the \n * NewlineAtEndOfFileCheck.\n * @author Martin Steiger\n * [7:2]
|  |  `--BLOCK_COMMENT_END -> */ [11:2]
|  `--LITERAL_PUBLIC -> public [12:0]

when Tree is printed with CR:

|--MODIFIERS -> MODIFIERS [12:0]
|   |--BLOCK_COMMENT_BEGIN -> /* [7:0]
|   |   |--COMMENT_CONTENT -> *\r * Test case for detection of an existing CR newline at EOF, using the \r * NewlineAtEndOfFileCheck.\r * @author Martin Steiger\r * [7:2]
|   |   `--BLOCK_COMMENT_END -> */ [7:131]
|   `--LITERAL_PUBLIC -> public [12:0]

LF is [11:2] but CR is [7:131]. CR doesn't start and end on the same line which is what is wrong. The whole file has CR and we treat them as new lines, so we should do the same for comments.

rnveach added a commit to rnveach/checkstyle that referenced this issue May 28, 2016

romani added a commit that referenced this issue May 28, 2016

@romani romani added this to the 6.19 milestone May 28, 2016

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani May 28, 2016

Member

fix is merged.

Member

romani commented May 28, 2016

fix is merged.

@romani romani closed this May 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment