Skip to content

Commit ef69118

Browse files
committed
Move JavaInput's comment on line ranges to InputOutput.ranges
The block comment above JavaInput's fields described "the following lists" of tok indices on each line, which live in InputOutput.ranges, and Error Prone's AlmostJavadoc flagged its {@code} tags. What it said that the field's Javadoc did not, that a /* comment spans lines and that the lists give the correspondence between input and output, is in that Javadoc now.
1 parent 8e26263 commit ef69118

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

‎open-java-format/src/main/java/com/palantir/javaformat/InputOutput.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ public final String getLine(int lineI) {
5252
return lines.get(lineI);
5353
}
5454

55-
/** The {@link Range}s of the tokens or comments lying on each line, in any part. */
55+
/**
56+
* The {@link Range}s of the tokens or comments lying on each line, in any part: a {@code /*} comment can lie on
57+
* several. With the same for the formatted output, they give the correspondence between input and output lines.
58+
*/
5659
protected final List<Range<Integer>> ranges = new ArrayList<>();
5760

5861
private static void addToRanges(List<Range<Integer>> ranges, int i, int k) {

‎open-java-format/src/main/java/com/palantir/javaformat/java/JavaInput.java‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,6 @@ public String toString() {
260260
private final Supplier<String> lineSeparator = Suppliers.memoize(() -> Newlines.guessLineSeparator(getText()));
261261
private int kN; // The number of numbered toks (tokens or comments), excluding the EOF.
262262

263-
/*
264-
* The following lists record the sequential indices of the {@code Tok}s on each input line. (Only
265-
* tokens and comments have sequential indices.) Tokens and {@code //} comments lie on just one
266-
* line; {@code /*} comments can lie on multiple lines. These data structures (along with
267-
* equivalent ones for the formatted output) let us compute correspondences between the input and
268-
* output.
269-
*/
270-
271263
private final Map<Integer, Integer> positionToColumnMap; // Map Tok position to column.
272264

273265
private final List<Token> tokens; // The Tokens for this input.

0 commit comments

Comments
 (0)