Skip to content

Commit 29c06fb

Browse files
Excavator: Upgrades Baseline to the latest version
1 parent 7261823 commit 29c06fb

File tree

15 files changed

+114
-45
lines changed

15 files changed

+114
-45
lines changed

.baseline/checkstyle/checkstyle.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@
468468
<property name="format" value="^_?[a-z][a-zA-Z0-9]+$"/>
469469
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
470470
</module>
471-
<module name="SingleLineJavadoc"/> <!-- Java Style Guide: General form -->
472471
<module name="SummaryJavadocCheck"> <!-- Java Coding Guidelines: Javadoc -->
473472
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
474473
</module>

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
1010
classpath 'com.netflix.nebula:nebula-publishing-plugin:14.1.1'
1111
classpath 'com.netflix.nebula:gradle-info-plugin:5.2.0'
12-
classpath 'com.palantir.baseline:gradle-baseline-java:2.31.0'
12+
classpath 'com.palantir.baseline:gradle-baseline-java:2.35.2'
1313
classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0'
1414
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2'
1515
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.12.4'

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ public OpsOutput build() {
563563
if (tokAfter.isComment()) {
564564
boolean breakAfter = tokAfter.isJavadocComment()
565565
|| (tokAfter.isSlashStarComment()
566-
&& tokenOp.breakAndIndentTrailingComment().isPresent());
566+
&& tokenOp.breakAndIndentTrailingComment()
567+
.isPresent());
567568
if (breakAfter) {
568569
tokOps.put(tokAfterPos, Break.make(
569570
FillMode.FORCED,
@@ -636,7 +637,10 @@ public OpsOutput build() {
636637
afterForcedBreak = isForcedBreak(op);
637638
}
638639
}
639-
return ImmutableOpsOutput.builder().ops(newOps.build()).inputMetadata(inputMetadataBuilder.build()).build();
640+
return ImmutableOpsOutput.builder()
641+
.ops(newOps.build())
642+
.inputMetadata(inputMetadataBuilder.build())
643+
.build();
640644
}
641645

642646
private static boolean isNonNlsComment(Input.Tok tokAfter) {

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ public static Break make(FillMode fillMode, String flat, Indent plusIndent) {
6060
* @return the new {@code Break}
6161
*/
6262
public static Break make(FillMode fillMode, String flat, Indent plusIndent, Optional<BreakTag> optTag) {
63-
return builder().fillMode(fillMode).flat(flat).plusIndent(plusIndent).optTag(optTag).build();
63+
return builder()
64+
.fillMode(fillMode)
65+
.flat(flat)
66+
.plusIndent(plusIndent)
67+
.optTag(optTag)
68+
.build();
6469
}
6570

6671
/**
@@ -69,7 +74,11 @@ public static Break make(FillMode fillMode, String flat, Indent plusIndent, Opti
6974
* @return the new forced {@code Break}
7075
*/
7176
public static Break makeForced() {
72-
return builder().fillMode(FillMode.FORCED).flat("").plusIndent(Indent.Const.ZERO).build();
77+
return builder()
78+
.fillMode(FillMode.FORCED)
79+
.flat("")
80+
.plusIndent(Indent.Const.ZERO)
81+
.build();
7382
}
7483

7584
/**

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ State breakTaken(BreakTag breakTag, boolean broken) {
114114
* not commit to the indent just yet though, so lastIndent stays the same.
115115
*/
116116
State withIndentIncrementedBy(Indent plusIndent) {
117-
return builder().from(this).indent(indent() + plusIndent.eval(this)).mustBreak(false).build();
117+
return builder()
118+
.from(this)
119+
.indent(indent() + plusIndent.eval(this))
120+
.mustBreak(false)
121+
.build();
118122
}
119123

120124
/** Reset any accumulated indent to the same value as {@code lastIndent}. */
@@ -177,15 +181,24 @@ State withMustBreak(boolean mustBreak) {
177181
}
178182

179183
State withNewBranch() {
180-
return builder().from(this).branchingCoefficient(branchingCoefficient() + 1).build();
184+
return builder()
185+
.from(this)
186+
.branchingCoefficient(branchingCoefficient() + 1)
187+
.build();
181188
}
182189

183190
State withLevelState(Level level, LevelState levelState) {
184-
return builder().from(this).levelStates(levelStates().set(level, levelState)).build();
191+
return builder()
192+
.from(this)
193+
.levelStates(levelStates().set(level, levelState))
194+
.build();
185195
}
186196

187197
State withTokState(Comment comment, TokState tokState) {
188-
return builder().from(this).tokStates(tokStates().set(comment, tokState)).build();
198+
return builder()
199+
.from(this)
200+
.tokStates(tokStates().set(comment, tokState))
201+
.build();
189202
}
190203

191204
public static class Builder extends ImmutableState.Builder {}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,10 @@ Range<Integer> characterRangeToTokenRange(int offset, int length) throws Formatt
561561
// 0 stands for "format the line under the cursor"
562562
length = 1;
563563
}
564-
ImmutableCollection<Token> enclosed =
565-
getPositionTokenMap().subRangeMap(Range.closedOpen(offset, offset + length)).asMapOfRanges().values();
564+
ImmutableCollection<Token> enclosed = getPositionTokenMap()
565+
.subRangeMap(Range.closedOpen(offset, offset + length))
566+
.asMapOfRanges()
567+
.values();
566568
if (enclosed.isEmpty()) {
567569
return EMPTY_RANGE;
568570
}
@@ -611,7 +613,10 @@ public ImmutableRangeMap<Integer, Token> getPositionTokenMap() {
611613

612614
@Override
613615
public String toString() {
614-
return MoreObjects.toStringHelper(this).add("tokens", tokens).add("super", super.toString()).toString();
616+
return MoreObjects.toStringHelper(this)
617+
.add("tokens", tokens)
618+
.add("super", super.toString())
619+
.toString();
615620
}
616621

617622
private JCCompilationUnit unit;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,9 @@ public Void visitModule(ModuleTree node, Void unused) {
24032403
for (DirectiveTree directiveTree : node.getDirectives()) {
24042404
markForPartialFormat();
24052405
builder.blankLineWanted(
2406-
previousDirective.map(k -> !k.equals(directiveTree.getKind())).orElse(false)
2406+
previousDirective
2407+
.map(k -> !k.equals(directiveTree.getKind()))
2408+
.orElse(false)
24072409
? BlankLineWanted.YES
24082410
: BlankLineWanted.NO);
24092411
builder.forcedBreak();

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ public int format(String... args) throws UsageException {
9595
}
9696

9797
// TODO(someone): update this to always use Style.PALANTIR
98-
JavaFormatterOptions options =
99-
JavaFormatterOptions.builder().style(parameters.aosp() ? Style.AOSP : Style.GOOGLE).build();
98+
JavaFormatterOptions options = JavaFormatterOptions.builder()
99+
.style(parameters.aosp() ? Style.AOSP : Style.GOOGLE)
100+
.build();
100101

101102
if (parameters.stdin()) {
102103
return formatStdin(parameters, options);

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ private static RangeMap<Integer, String> buildReplacements(
247247
endPosition = Math.max(CharMatcher.isNot(' ').indexIn(contents, endPosition), endPosition);
248248
String sep = Newlines.guessLineSeparator(contents);
249249
if (endPosition + sep.length() < contents.length()
250-
&& contents.subSequence(endPosition, endPosition + sep.length()).toString().equals(sep)) {
250+
&& contents.subSequence(endPosition, endPosition + sep.length())
251+
.toString()
252+
.equals(sep)) {
251253
endPosition += sep.length();
252254
}
253255
replacements.put(Range.closedOpen(importTree.getStartPosition(), endPosition), "");
@@ -258,7 +260,9 @@ private static RangeMap<Integer, String> buildReplacements(
258260
private static String getSimpleName(JCImport importTree) {
259261
return importTree.getQualifiedIdentifier() instanceof JCIdent
260262
? ((JCIdent) importTree.getQualifiedIdentifier()).getName().toString()
261-
: ((JCFieldAccess) importTree.getQualifiedIdentifier()).getIdentifier().toString();
263+
: ((JCFieldAccess) importTree.getQualifiedIdentifier())
264+
.getIdentifier()
265+
.toString();
262266
}
263267

264268
private static boolean isUnused(
@@ -275,7 +279,9 @@ private static boolean isUnused(
275279
return true;
276280
}
277281
if (importTree.getQualifiedIdentifier() instanceof JCFieldAccess
278-
&& ((JCFieldAccess) importTree.getQualifiedIdentifier()).getIdentifier().contentEquals("*")) {
282+
&& ((JCFieldAccess) importTree.getQualifiedIdentifier())
283+
.getIdentifier()
284+
.contentEquals("*")) {
279285
return false;
280286
}
281287

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ static String getSourceForNode(Tree node, TreePath path) {
5656
} catch (IOException e) {
5757
throw new IOError(e);
5858
}
59-
return source.subSequence(getStartPosition(node), getEndPosition(node, path)).toString();
59+
return source.subSequence(getStartPosition(node), getEndPosition(node, path))
60+
.toString();
6061
}
6162

6263
/** Returns the simple name of a (possibly qualified) method invocation expression. */

0 commit comments

Comments
 (0)