Skip to content

Commit be188f7

Browse files
Excavator: Upgrades Baseline to the latest version (#1308)
1 parent ecf61ca commit be188f7

File tree

13 files changed

+37
-1
lines changed

13 files changed

+37
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
dependencies {
88
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0'
99
classpath 'com.gradle.publish:plugin-publish-plugin:1.3.1'
10-
classpath 'com.palantir.baseline:gradle-baseline-java:6.29.0'
10+
classpath 'com.palantir.baseline:gradle-baseline-java:6.32.0'
1111
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.34.0'
1212
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0'
1313
classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.13.0'

gradle-palantir-java-format/src/main/java/com/palantir/javaformat/gradle/JavaFormatExtension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public FormatterService serviceLoad() {
3939
return memoizedService.get();
4040
}
4141

42+
@SuppressWarnings("for-rollout:NullAway")
4243
private FormatterService serviceLoadInternal() {
4344
URL[] jarUris = configuration.getFiles().stream()
4445
.map(file -> {

palantir-java-format/src/main/java/com/palantir/javaformat/OpsBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ public final class OpsBuilder {
5050
/** Return the actual size of the AST node at position, including comments. */
5151
public int actualSize(int position, int length) {
5252
Input.Token startToken = input.getPositionTokenMap().get(position);
53+
@SuppressWarnings("for-rollout:NullAway")
5354
int start = startToken.getTok().getPosition();
5455
for (Input.Tok tok : startToken.getToksBefore()) {
5556
if (tok.isComment()) {
5657
start = Math.min(start, tok.getPosition());
5758
}
5859
}
5960
Input.Token endToken = input.getPositionTokenMap().get(position + length - 1);
61+
@SuppressWarnings("for-rollout:NullAway")
6062
int end = endToken.getTok().getPosition() + endToken.getTok().length();
6163
for (Input.Tok tok : endToken.getToksAfter()) {
6264
if (tok.isComment()) {
@@ -69,6 +71,7 @@ public int actualSize(int position, int length) {
6971
/** Return the start column of the token at {@code position}, including leading comments. */
7072
public Integer actualStartColumn(int position) {
7173
Input.Token startToken = input.getPositionTokenMap().get(position);
74+
@SuppressWarnings("for-rollout:NullAway")
7275
int start = startToken.getTok().getPosition();
7376
int line0 = input.getLineNumber(start);
7477
for (Input.Tok tok : startToken.getToksBefore()) {

palantir-java-format/src/main/java/com/palantir/javaformat/doc/Comment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ protected Range<Integer> computeRange() {
8787
public State computeBreaks(
8888
CommentsHelper commentsHelper, int maxWidth, State state, Obs.ExplorationNode observationNode) {
8989
String text = commentsHelper.rewrite(tok, maxWidth, state.column());
90+
@SuppressWarnings("for-rollout:NullAway")
9091
int firstLineLength = text.length() - Iterators.getLast(Newlines.lineOffsetIterator(text));
9192
return state.withColumn(state.column() + firstLineLength)
9293
.addNewLines(Iterators.size(Newlines.lineOffsetIterator(text)))

palantir-java-format/src/main/java/com/palantir/javaformat/doc/Level.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ private Optional<State> tryInlinePrefixOntoCurrentLine(
337337
commentsHelper, maxWidth, newState, memoizedSplitsBreaks.get(), explorationNode));
338338
}
339339

340+
@SuppressWarnings("for-rollout:NullAway")
340341
private Optional<State> tryBreakLastLevel(
341342
CommentsHelper commentsHelper,
342343
int maxWidth,
@@ -351,6 +352,7 @@ private Optional<State> tryBreakLastLevel(
351352
return tryBreakInnerLevel(commentsHelper, maxWidth, state, explorationNode, innerLevel, isSimpleInliningSoFar);
352353
}
353354

355+
@SuppressWarnings("for-rollout:NullAway")
354356
private Optional<State> tryInlineSuffix(
355357
CommentsHelper commentsHelper,
356358
int maxWidth,
@@ -470,6 +472,7 @@ private static Optional<State> tryBreakInnerLevel_acceptInlineChain(
470472
.markAccepted());
471473
}
472474

475+
@SuppressWarnings("for-rollout:NullAway")
473476
private static Optional<State> tryBreakInnerLevel_checkInner(
474477
CommentsHelper commentsHelper,
475478
int maxWidth,

palantir-java-format/src/main/java/com/palantir/javaformat/java/ImportOrderer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ private String reorderImports() throws FormatterException {
9393
tail.add(CharMatcher.whitespace().trimLeadingFrom(tokString(afterLastImport, toks.size())));
9494
if (!toks.isEmpty()) {
9595
Tok lastTok = getLast(toks);
96+
@SuppressWarnings("for-rollout:NullAway")
9697
int tailStart = lastTok.getPosition() + lastTok.length();
9798
tail.add(text.substring(tailStart));
9899
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ public String getLineSeparator() {
331331
}
332332

333333
/** Lex the input and build the list of toks. */
334+
@SuppressWarnings("for-rollout:NullAway")
334335
private ImmutableList<Tok> buildToks(String text) throws FormatterException {
335336
ImmutableList<Tok> toks = buildToks(text, ImmutableSet.of());
336337
kN = getLast(toks).getIndex();
@@ -462,6 +463,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept
462463
return ImmutableList.copyOf(toks);
463464
}
464465

466+
@SuppressWarnings("for-rollout:NullAway")
465467
private static int updateColumn(int columnI, String originalTokText) {
466468
Integer last = Iterators.getLast(Newlines.lineOffsetIterator(originalTokText));
467469
if (last > 0) {
@@ -556,6 +558,7 @@ private static boolean isParamComment(Tok tok) {
556558
* @return the {@code 0}-based {@link Range} of tokens
557559
* @throws FormatterException on formatting errors
558560
*/
561+
@SuppressWarnings("for-rollout:NullAway")
559562
Range<Integer> characterRangeToTokenRange(int offset, int length) throws FormatterException {
560563
int requiredLength = offset + length;
561564
if (requiredLength > text.length()) {

palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ private TypeWithDims variableFragmentDims(boolean first, int leadingDims, Tree t
997997
null, leadingDims > 0 ? dims.dims.subList(0, dims.dims.size() - leadingDims) : dims.dims);
998998
}
999999

1000+
@SuppressWarnings("for-rollout:NullAway")
10001001
@Override
10011002
public Void visitForLoop(ForLoopTree node, Void unused) {
10021003
sync(node);
@@ -1622,6 +1623,7 @@ private static List<Long> handleStream(List<ExpressionTree> parts) {
16221623
.collect(toList());
16231624
}
16241625

1626+
@SuppressWarnings("for-rollout:NullAway")
16251627
private static <T> Stream<Long> indexes(Stream<T> stream, Predicate<T> predicate) {
16261628
return Streams.mapWithIndex(stream, (x, i) -> predicate.apply(x) ? i : -1)
16271629
.filter(x -> x != -1);
@@ -1802,6 +1804,7 @@ public Void visitReturn(ReturnTree node, Void unused) {
18021804
}
18031805

18041806
// TODO(cushon): is this worth special-casing?
1807+
@SuppressWarnings("for-rollout:NullAway")
18051808
boolean visitSingleMemberAnnotation(AnnotationTree node) {
18061809
if (node.getArguments().size() != 1) {
18071810
return false;
@@ -2172,6 +2175,7 @@ private void visitStatement(
21722175
}
21732176
}
21742177

2178+
@SuppressWarnings("for-rollout:NullAway")
21752179
protected void visitStatements(List<? extends StatementTree> statements, boolean inlineFirst) {
21762180
boolean first = true;
21772181
PeekingIterator<StatementTree> it = Iterators.peekingIterator(statements.iterator());
@@ -2186,6 +2190,7 @@ protected void visitStatements(List<? extends StatementTree> statements, boolean
21862190
}
21872191
markForPartialFormat();
21882192
first = false;
2193+
@SuppressWarnings("for-rollout:NullAway")
21892194
List<VariableTree> fragments = variableFragments(it, tree);
21902195
if (!fragments.isEmpty()) {
21912196
visitVariables(
@@ -2820,6 +2825,7 @@ private void visitRegularDot(List<ExpressionTree> items, boolean needDot) {
28202825
// .happens())
28212826
// .thenReturn(result);
28222827
//
2828+
@SuppressWarnings("for-rollout:NullAway")
28232829
private boolean fillFirstArgument(ExpressionTree e, List<ExpressionTree> items, Indent indent) {
28242830
// is there a trailing dereference?
28252831
if (items.size() < 2) {
@@ -2860,6 +2866,7 @@ private boolean fillFirstArgument(ExpressionTree e, List<ExpressionTree> items,
28602866
private void visitDotWithPrefix(
28612867
List<ExpressionTree> items, boolean needDot, Collection<Integer> prefixes, FillMode prefixFillMode) {
28622868
// Are there method invocations or field accesses after the prefix?
2869+
@SuppressWarnings("for-rollout:NullAway")
28632870
boolean trailingDereferences = !prefixes.isEmpty() && getLast(prefixes) < items.size() - 1;
28642871

28652872
boolean hasMethodInvocations = items.stream().anyMatch(expr -> expr.getKind() == METHOD_INVOCATION);
@@ -3253,12 +3260,14 @@ public void scan(JCTree tree) {
32533260
}
32543261

32553262
/** Returns the number of columns if the arguments arg laid out in a grid, or else {@code -1}. */
3263+
@SuppressWarnings("for-rollout:NullAway")
32563264
private int argumentsAreTabular(List<? extends ExpressionTree> arguments) {
32573265
if (arguments.isEmpty()) {
32583266
return -1;
32593267
}
32603268
List<List<ExpressionTree>> rows = new ArrayList<>();
32613269
PeekingIterator<ExpressionTree> it = Iterators.peekingIterator(arguments.iterator());
3270+
@SuppressWarnings("for-rollout:NullAway")
32623271
int start0 = actualColumn(it.peek());
32633272
{
32643273
List<ExpressionTree> row = new ArrayList<>();
@@ -3276,6 +3285,7 @@ private int argumentsAreTabular(List<? extends ExpressionTree> arguments) {
32763285
}
32773286
while (it.hasNext()) {
32783287
List<ExpressionTree> row = new ArrayList<>();
3288+
@SuppressWarnings("for-rollout:NullAway")
32793289
int start = actualColumn(it.peek());
32803290
if (start != start0) {
32813291
return -1;
@@ -3338,6 +3348,7 @@ private Integer actualColumn(ExpressionTree expression) {
33383348
}
33393349

33403350
/** How many lines does this node take up in the input. Returns at least 1. */
3351+
@SuppressWarnings("for-rollout:NullAway")
33413352
int lineSpan(Tree node) {
33423353
ImmutableRangeMap<Integer, ? extends Input.Token> positionTokenMap =
33433354
builder.getInput().getPositionTokenMap();
@@ -3646,6 +3657,7 @@ protected void addBodyDeclarations(
36463657
Tree bodyDeclaration = it.next();
36473658
dropEmptyDeclarations();
36483659
builder.forcedBreak();
3660+
@SuppressWarnings("for-rollout:NullAway")
36493661
boolean thisOneGetsBlankLineBefore =
36503662
bodyDeclaration.getKind() != VARIABLE || hasJavaDoc(bodyDeclaration);
36513663
if (first) {
@@ -3712,6 +3724,7 @@ private void classDeclarationTypeList(String token, List<? extends Tree> types)
37123724
*
37133725
* <p>e.g. {@code int x, y;} is parsed as {@code int x; int y;}.
37143726
*/
3727+
@SuppressWarnings("for-rollout:NullAway")
37153728
private List<VariableTree> variableFragments(PeekingIterator<? extends Tree> it, Tree first) {
37163729
List<VariableTree> fragments = new ArrayList<>();
37173730
if (first.getKind() == VARIABLE) {
@@ -3748,6 +3761,7 @@ private boolean hasTrailingToken(Input input, List<? extends Tree> nodes, String
37483761
return false;
37493762
}
37503763
Tree lastNode = getLast(nodes);
3764+
@SuppressWarnings("for-rollout:NullAway")
37513765
Optional<? extends Input.Token> nextToken = getNextToken(input, getEndPosition(lastNode, getCurrentPath()));
37523766
return nextToken.isPresent() && nextToken.get().getTok().getText().equals(token);
37533767
}

palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaOutput.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ public ImmutableList<Replacement> getFormatReplacements(RangeSet<Integer> iRange
292292
* @param iRange the {@link Range} of tokens
293293
* @return the expanded token range
294294
*/
295+
@SuppressWarnings("for-rollout:NullAway")
295296
private Range<Integer> expandToBreakableRegions(Range<Integer> iRange) {
296297
// The original line range.
297298
int loTok = iRange.lowerEndpoint();

palantir-java-format/src/main/java/com/palantir/javaformat/java/StringWrapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ private static ImmutableSet<Range<Integer>> rangesAfterAppliedReplacements(
113113
return outputRanges.build();
114114
}
115115

116+
@SuppressWarnings("for-rollout:NullAway")
116117
private static TreeRangeMap<Integer, String> getReflowReplacements(int columnLimit, final String input)
117118
throws FormatterException {
118119
JCTree.JCCompilationUnit unit = parse(input, /* allowStringFolding= */ false);
@@ -173,6 +174,7 @@ public Void visitLiteral(LiteralTree literalTree, Void aVoid) {
173174

174175
// Handling leaving trailing non-string tokens at the end of the literal,
175176
// e.g. the trailing `);` in `foo("...");`.
177+
@SuppressWarnings("for-rollout:NullAway")
176178
int end = getEndPosition(unit, getLast(flat));
177179
int lineEnd = end;
178180
while (Newlines.hasNewlineAt(input, lineEnd) == -1) {

palantir-java-format/src/main/java/com/palantir/javaformat/java/java14/Java14InputAstVisitor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ public Void visitInstanceOf(InstanceOfTree node, Void unused) {
252252
return null;
253253
}
254254

255+
@SuppressWarnings("for-rollout:NullAway")
255256
@Override
256257
public Void visitCase(CaseTree node, Void unused) {
257258
sync(node);

palantir-java-format/src/main/java/com/palantir/javaformat/java/javadoc/JavadocLexer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ private void checkMatchingTags() throws LexException {
261261
*
262262
* <p>Note that we do <i>not</i> merge a literal token and a whitespace token together.
263263
*/
264+
@SuppressWarnings("for-rollout:NullAway")
264265
private static ImmutableList<Token> joinAdjacentLiteralsAndAdjacentWhitespace(List<Token> input) {
265266
/*
266267
* Note: Our final token is always END_JAVADOC. This saves us some trouble:
@@ -275,6 +276,7 @@ private static ImmutableList<Token> joinAdjacentLiteralsAndAdjacentWhitespace(Li
275276
boolean lastTagWasInlineTagStart = false;
276277

277278
for (PeekingIterator<Token> tokens = peekingIterator(input.iterator()); tokens.hasNext(); ) {
279+
@SuppressWarnings("for-rollout:NullAway")
278280
Token.Type nextType = tokens.peek().getType();
279281
if (nextType == INLINE_TAG_OPEN) {
280282
inlineTagDepth.increment();
@@ -345,6 +347,7 @@ private static ImmutableList<Token> joinAdjacentLiteralsAndAdjacentWhitespace(Li
345347
* <p>This method must be called after {@link #joinAdjacentLiteralsAndAdjacentWhitespace}, as it assumes that
346348
* adjacent whitespace tokens have already been joined.
347349
*/
350+
@SuppressWarnings("for-rollout:NullAway")
348351
private static ImmutableList<Token> inferParagraphTags(List<Token> input) {
349352
ImmutableList.Builder<Token> output = ImmutableList.builder();
350353

@@ -383,6 +386,7 @@ && hasMultipleNewlines(tokens.peek().getValue())) {
383386
* <p>This method must be called after {@link #joinAdjacentLiteralsAndAdjacentWhitespace}, as it assumes that
384387
* adjacent whitespace tokens have already been joined.
385388
*/
389+
@SuppressWarnings("for-rollout:NullAway")
386390
private static ImmutableList<Token> optionalizeSpacesAfterLinks(List<Token> input) {
387391
ImmutableList.Builder<Token> output = ImmutableList.builder();
388392

@@ -412,6 +416,7 @@ private static ImmutableList<Token> optionalizeSpacesAfterLinks(List<Token> inpu
412416
*
413417
* <p>Also trim leading and trailing blank lines, and move the trailing `}` to its own line.
414418
*/
419+
@SuppressWarnings("for-rollout:NullAway")
415420
private static ImmutableList<Token> deindentPreCodeBlocks(List<Token> input) {
416421
ImmutableList.Builder<Token> output = ImmutableList.builder();
417422
for (PeekingIterator<Token> tokens = peekingIterator(input.iterator()); tokens.hasNext(); ) {

palantir-java-format/src/main/java/com/palantir/javaformat/java/javadoc/JavadocWriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ private void requestNewline() {
271271
requestWhitespace(NEWLINE);
272272
}
273273

274+
@SuppressWarnings("for-rollout:NullAway")
274275
private void requestWhitespace(RequestedWhitespace requestedWhitespace) {
275276
this.requestedWhitespace = Ordering.natural().max(requestedWhitespace, this.requestedWhitespace);
276277
}

0 commit comments

Comments
 (0)