Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with line ending immediately after javadoc tag #4980

Open
voidfist opened this issue Aug 21, 2017 · 2 comments
Open

Problem with line ending immediately after javadoc tag #4980

voidfist opened this issue Aug 21, 2017 · 2 comments

Comments

@voidfist
Copy link
Contributor

voidfist commented Aug 21, 2017

$ cat test.javadoc (CRLF line endings)

* @exception
      Exception     Exception-description
      spanning multiple lines

java -jar master-8.2-all.jar -j test.javadoc

JAVADOC -> JAVADOC [0:0]
|--LEADING_ASTERISK -> * [0:0]
|--WS ->   [0:1]
|--JAVADOC_TAG -> JAVADOC_TAG [0:2]
|   |--EXCEPTION_LITERAL -> @exception [0:2]
|   |--NEWLINE -> \r\n [0:13]
|   |--WS ->        [1:0]
|   `--DESCRIPTION -> DESCRIPTION [1:6]
|       |--TEXT -> Exception     Exception-description [1:6]
|       |--NEWLINE -> \r\n [1:41]
|       `--TEXT ->       spanning multiple lines [2:0]
`--EOF -> <EOF> [2:29]

ALSO please note that CLASS_NAME is not being recognized in the above example which can be resolved by adding NEWLINE to corresponding lexer mode

cat test.javadoc (with LF line endings)

* @exception
      Exception     Exception-description
      spanning multiple lines

java -jar master-8.2-all.jar -j test.javadoc

JAVADOC -> JAVADOC [0:0]
|--LEADING_ASTERISK -> * [0:0]
|--WS ->   [0:1]
|--JAVADOC_TAG -> JAVADOC_TAG [0:2]
|   |--EXCEPTION_LITERAL -> @exception [0:2]
|   |--NEWLINE -> \n [1:0]
|   |--WS ->        [2:0]
|   `--DESCRIPTION -> DESCRIPTION [2:6]
|       |--TEXT -> Exception     Exception-description [2:6]
|       |--NEWLINE -> \n [2:41]
|       `--TEXT ->       spanning multiple lines [3:0]
`--EOF -> <EOF> [3:29]

SIMILAR CASES

@param

cat test.javadoc (with CRLF line endings)

* @param
       parameter

java -jar master-8.2-all.jar -j test.javadoc

JAVADOC -> JAVADOC [0:0]
|--LEADING_ASTERISK -> * [0:0]
|--WS ->   [0:1]
|--JAVADOC_TAG -> JAVADOC_TAG [0:2]
|   |--PARAM_LITERAL -> @param [0:2]
|   |--NEWLINE -> \r\n [0:9]
|   |--WS ->         [1:0]
|   `--DESCRIPTION -> DESCRIPTION [1:7]
|       `--TEXT -> parameter [1:7]
`--EOF -> <EOF> [1:16]

ALSO please note that PARAM_NAME is not being recognized in the above example which can be resolved by adding NEWLINE to corresponding lexer mode

WITH LF line endings

java -jar master-8.2-all.jar -j test.javadoc

JAVADOC -> JAVADOC [0:0]
|--LEADING_ASTERISK -> * [0:0]
|--WS ->   [0:1]
|--JAVADOC_TAG -> JAVADOC_TAG [0:2]
|   |--PARAM_LITERAL -> @param [0:2]
|   |--NEWLINE -> \n [1:0]
|   |--WS ->         [2:0]
|   `--DESCRIPTION -> DESCRIPTION [2:7]
|       `--TEXT -> parameter [2:7]
`--EOF -> <EOF> [2:16]

@throws

cat test.javadoc (with CRLF line endings)

* @throws
     Exception     Exception-description
         spanning multiple lines

java -jar master-8.2-all.jar -j test.javadoc

JAVADOC -> JAVADOC [0:0]
|--LEADING_ASTERISK -> * [0:0]
|--WS ->   [0:1]
|--JAVADOC_TAG -> JAVADOC_TAG [0:2]
|   |--THROWS_LITERAL -> @throws [0:2]
|   |--NEWLINE -> \r\n [0:10]
|   |--WS ->       [1:0]
|   `--DESCRIPTION -> DESCRIPTION [1:5]
|       |--TEXT -> Exception     Exception-description [1:5]
|       |--NEWLINE -> \r\n [1:40]
|       `--TEXT ->          spanning multiple lines [2:0]
`--EOF -> <EOF> [2:32]

ALSO please note that CLASS_NAME is not being recognized in the above example which can be resolved by adding NEWLINE to corresponding lexer mode

WITH LF line endings

java -jar master-8.2-all.jar -j test.javadoc

JAVADOC -> JAVADOC [0:0]
|--LEADING_ASTERISK -> * [0:0]
|--WS ->   [0:1]
|--JAVADOC_TAG -> JAVADOC_TAG [0:2]
|   |--THROWS_LITERAL -> @throws [0:2]
|   |--NEWLINE -> \n [1:0]
|   |--WS ->       [2:0]
|   `--DESCRIPTION -> DESCRIPTION [2:5]
|       |--TEXT -> Exception     Exception-description [2:5]
|       |--NEWLINE -> \n [2:40]
|       `--TEXT ->          spanning multiple lines [3:0]
`--EOF -> <EOF> [3:32]

The position of NEWLINE immediately after the javadoc tag is getting affected by the type of line endings in the file.

This behaviour repeats with *7.6.2-SNAPSHOT-all.jar too. So it's not something due to any recent changes.

This issue should relate to #4824 and the fact that there is no recognition for NEWLINE in the corresponding Lexer modes.

All the lexer modes with no NEWLINE should display the same behaviour. One easy fix would be to introduce NEWLINE in those lexer modes.

@romani
Copy link
Member

romani commented Aug 22, 2017

@PS-SP , please send draft fix for review.
Regression is critical to evaluate a fix.

@Vladlis
Copy link
Contributor

Vladlis commented Aug 24, 2017

As a result of this fix gitattributes has to be modified #4938 (comment)

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

No branches or pull requests

3 participants