Skip to content

Commit 16bb99f

Browse files
Excavator: Upgrades Baseline to the latest version (#27)
1 parent c9bb828 commit 16bb99f

File tree

13 files changed

+28
-30
lines changed

13 files changed

+28
-30
lines changed

.baseline/checkstyle/checkstyle.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@
8484
<module name="AvoidStarImport"/> <!-- Java Style Guide: No wildcard imports -->
8585
<module name="AvoidStaticImport"> <!-- Java Style Guide: No static imports -->
8686
<property name="excludes" value="
87+
com.google.common.base.Preconditions.*,
88+
com.palantir.logsafe.Preconditions.*,
8789
java.util.Collections.*,
8890
java.util.stream.Collectors.*,
89-
com.palantir.logsafe.Preconditions.*,
90-
com.google.common.base.Preconditions.*,
91-
org.apache.commons.lang3.Validate.*"/>
91+
org.apache.commons.lang3.Validate.*,
92+
org.assertj.core.api.Assertions.*,
93+
org.mockito.Mockito.*"/>
9294
</module>
9395
<module name="ClassTypeParameterName"> <!-- Java Style Guide: Type variable names -->
9496
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>

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.0.0'
1111
classpath 'com.netflix.nebula:gradle-info-plugin:5.1.1'
12-
classpath 'com.palantir.baseline:gradle-baseline-java:2.21.0'
12+
classpath 'com.palantir.baseline:gradle-baseline-java:2.24.0'
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'

idea-plugin/src/main/java/com/palantir/javaformat/intellij/PalantirJavaFormatSettings.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ static class State {
9696
public JavaFormatterOptions.Style style = JavaFormatterOptions.Style.PALANTIR;
9797

9898
public void setImplementationClassPath(@Nullable List<String> value) {
99-
implementationClassPath =
100-
Optional.ofNullable(value)
101-
.map(strings -> strings.stream().map(URI::create).collect(Collectors.toList()));
99+
implementationClassPath = Optional.ofNullable(value)
100+
.map(strings -> strings.stream().map(URI::create).collect(Collectors.toList()));
102101
}
103102

104103
public List<String> getImplementationClassPath() {

palantir-java-format-api/src/main/java/com/palantir/javaformat/java/FormatterDiagnostic.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public String message() {
6060
return message;
6161
}
6262

63+
@Override
6364
public String toString() {
6465
StringBuilder sb = new StringBuilder();
6566
if (lineNumber >= 0) {

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private void add(Op op) {
161161
} else if (op instanceof CloseOp) {
162162
depth--;
163163
if (depth < 0) {
164-
throw new AssertionError();
164+
throw new IllegalStateException();
165165
}
166166
}
167167
ops.add(op);
@@ -508,9 +508,8 @@ public final ImmutableList<Op> build() {
508508
if (tokBefore.isJavadocComment()) {
509509
tokOps.put(j, Break.makeForced());
510510
}
511-
allowBlankAfterLastComment =
512-
tokBefore.isSlashSlashComment()
513-
|| (tokBefore.isSlashStarComment() && !tokBefore.isJavadocComment());
511+
allowBlankAfterLastComment = tokBefore.isSlashSlashComment()
512+
|| (tokBefore.isSlashStarComment() && !tokBefore.isJavadocComment());
514513
}
515514
}
516515
if (allowBlankAfterLastComment && newlines > 1) {

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,13 @@ private State computeBroken(CommentsHelper commentsHelper, int maxWidth, State s
356356
state = state.withBrokenLevel();
357357
}
358358

359-
state =
360-
computeBreakAndSplit(
361-
commentsHelper, maxWidth, state, /* optBreakDoc= */ Optional.empty(), splits.get(0));
359+
state = computeBreakAndSplit(
360+
commentsHelper, maxWidth, state, /* optBreakDoc= */ Optional.empty(), splits.get(0));
362361

363362
// Handle following breaks and split.
364363
for (int i = 0; i < breaks.size(); i++) {
365-
state =
366-
computeBreakAndSplit(
367-
commentsHelper, maxWidth, state, Optional.of(breaks.get(i)), splits.get(i + 1));
364+
state = computeBreakAndSplit(
365+
commentsHelper, maxWidth, state, Optional.of(breaks.get(i)), splits.get(i + 1));
368366
}
369367
return state;
370368
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import com.google.common.collect.ImmutableSortedSet;
5454
import com.google.common.collect.Iterables;
5555
import com.google.common.collect.Iterators;
56+
import com.google.common.collect.Lists;
5657
import com.google.common.collect.Multiset;
5758
import com.google.common.collect.PeekingIterator;
5859
import com.google.common.collect.Streams;
@@ -483,7 +484,7 @@ public boolean visitArrayInitializer(List<? extends ExpressionTree> expressions)
483484
token("{");
484485
builder.forcedBreak();
485486
boolean first = true;
486-
for (Iterable<? extends ExpressionTree> row : Iterables.partition(expressions, cols)) {
487+
for (Iterable<? extends ExpressionTree> row : Lists.partition(expressions, cols)) {
487488
if (!first) {
488489
builder.forcedBreak();
489490
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ public ImmutableList<Replacement> format(
105105
ranges = offsetRanges(ranges, wrapper.offset);
106106

107107
String replacement = formatter.formatSource(wrapper.contents.toString(), ranges);
108-
replacement =
109-
replacement.substring(
110-
wrapper.offset,
111-
replacement.length() - (wrapper.contents.length() - wrapper.offset - source.length()));
108+
replacement = replacement.substring(
109+
wrapper.offset, replacement.length() - (wrapper.contents.length() - wrapper.offset - source.length()));
112110

113111
return toReplacements(source, replacement).stream().filter(r -> rangeSet.encloses(r.getReplaceRange())).collect(
114112
toImmutableList());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static ClassTree getEnclosingTypeDeclaration(TreePath path) {
105105
break;
106106
}
107107
}
108-
throw new AssertionError();
108+
throw new IllegalStateException();
109109
}
110110

111111
/** Skips a single parenthesized tree. */

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public TyParseState next(JavaCaseFormat n) {
4343
case UPPER_CAMEL:
4444
return TyParseState.TYPE;
4545
}
46-
throw new AssertionError();
46+
throw new IllegalStateException();
4747
}
4848
},
4949

@@ -59,7 +59,7 @@ public TyParseState next(JavaCaseFormat n) {
5959
case UPPER_CAMEL:
6060
return TyParseState.TYPE;
6161
}
62-
throw new AssertionError();
62+
throw new IllegalStateException();
6363
}
6464
},
6565

@@ -92,7 +92,7 @@ public TyParseState next(JavaCaseFormat n) {
9292
case UPPER_CAMEL:
9393
return TyParseState.TYPE;
9494
}
95-
throw new AssertionError();
95+
throw new IllegalStateException();
9696
}
9797
};
9898

0 commit comments

Comments
 (0)