-
Type:
Enhancement
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 17
-
Component/s: tools
-
b18
In javac, we should define the (internal) value Position.NOPOS to have the same value as the (external) public value Diagnostic.NOPOS.
The values are conceptually the same; the code in JCTree uses Position.NOPOS, and tree positions are routinely used in diagnostics. The public Diagnostic.NOPOS was introduced in JSR199 to define the sentinel value, and Position.NOPOS was/is in an internal API that should not be exposed directly. The difference in type (the public value is `long`, the internal value is just `int`) is because of the general policy in `javax.tools` to support alternate tool implementations that might support huge files, even though javac itself only supports `int`-sized files.
The values are conceptually the same; the code in JCTree uses Position.NOPOS, and tree positions are routinely used in diagnostics. The public Diagnostic.NOPOS was introduced in JSR199 to define the sentinel value, and Position.NOPOS was/is in an internal API that should not be exposed directly. The difference in type (the public value is `long`, the internal value is just `int`) is because of the general policy in `javax.tools` to support alternate tool implementations that might support huge files, even though javac itself only supports `int`-sized files.