Diagnostic.getColumnNumber specification
Tagir Valeev
amaembo at gmail.com
Fri Nov 1 12:13:34 UTC 2019
Hello!
javax.tools.Diagnostic#getColumnNumber spec currently says [1]:
> Returns the column number of the character offset returned by getPosition().
This spec says nothing about handling the tabulation ('\t') character.
Current javac implementation increases column to the next number
divisible by 8 every time the tabulation character is encountered.
Nowadays people use different tab widths, so I would not say that
everybody would expect this behavior by default. I suggest improving
the specification of this method adding the information about how
tabulations are handled. What do you think? Is it a useful change?
Also, there's a small typo in the getPosition() method spec [2]:
Returns a character offset from the beginning of the source object
associated with this diagnostic that indicates the location of the
problem. In addition, the following must be true:
getStartPostion() <= getPosition() <----- should be getStartPostion
('i' is missing)
getPosition() <= getEndPosition()
With best regards,
Tagir Valeev.
[1] https://docs.oracle.com/en/java/javase/13/docs/api/java.compiler/javax/tools/Diagnostic.html#getColumnNumber()
[2] https://docs.oracle.com/en/java/javase/13/docs/api/java.compiler/javax/tools/Diagnostic.html#getPosition()
More information about the compiler-dev
mailing list