Currently, we have different components in the java analyzer that compute the end position of a token, and each time in a different way (SonarComponents, InternalSyntaxToken, SyntaxHighlighterVisitor):
- the majority does not support tokens on multiple lines
- some support tokens on multiple lines but the result is not consistent with others
The improvement is:
- compute only once the end position (line, column) of a token and expose its value on the SyntaxToken public API
- try to be more explicit in the code about columns. Currently, SyntaxToken#column() start at 0 instead of 1 and there's often a mess of "+ 1" or "- 1" around. SonarJava's developers should be encouraged to always use the column number (starting at 1, the only one understood by our users) and should have access to the column offset (starting at 0, used for external integration like sonar-plugin-api) without computation.