Skip to content

Commit

Permalink
Excavator: Upgrades Baseline to the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot committed Oct 17, 2019
1 parent c9bb828 commit 6abfb0a
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 30 deletions.
8 changes: 5 additions & 3 deletions .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@
<module name="AvoidStarImport"/> <!-- Java Style Guide: No wildcard imports -->
<module name="AvoidStaticImport"> <!-- Java Style Guide: No static imports -->
<property name="excludes" value="
com.google.common.base.Preconditions.*,
com.palantir.logsafe.Preconditions.*,
java.util.Collections.*,
java.util.stream.Collectors.*,
com.palantir.logsafe.Preconditions.*,
com.google.common.base.Preconditions.*,
org.apache.commons.lang3.Validate.*"/>
org.apache.commons.lang3.Validate.*,
org.assertj.core.api.Assertions.*,
org.mockito.Mockito.*"/>
</module>
<module name="ClassTypeParameterName"> <!-- Java Style Guide: Type variable names -->
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.netflix.nebula:nebula-publishing-plugin:14.0.0'
classpath 'com.netflix.nebula:gradle-info-plugin:5.1.1'
classpath 'com.palantir.baseline:gradle-baseline-java:2.21.0'
classpath 'com.palantir.baseline:gradle-baseline-java:2.24.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.12.4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ static class State {
public JavaFormatterOptions.Style style = JavaFormatterOptions.Style.PALANTIR;

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

public List<String> getImplementationClassPath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public String message() {
return message;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if (lineNumber >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void add(Op op) {
} else if (op instanceof CloseOp) {
depth--;
if (depth < 0) {
throw new AssertionError();
throw new IllegalStateException();
}
}
ops.add(op);
Expand Down Expand Up @@ -508,9 +508,8 @@ public final ImmutableList<Op> build() {
if (tokBefore.isJavadocComment()) {
tokOps.put(j, Break.makeForced());
}
allowBlankAfterLastComment =
tokBefore.isSlashSlashComment()
|| (tokBefore.isSlashStarComment() && !tokBefore.isJavadocComment());
allowBlankAfterLastComment = tokBefore.isSlashSlashComment()
|| (tokBefore.isSlashStarComment() && !tokBefore.isJavadocComment());
}
}
if (allowBlankAfterLastComment && newlines > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,13 @@ private State computeBroken(CommentsHelper commentsHelper, int maxWidth, State s
state = state.withBrokenLevel();
}

state =
computeBreakAndSplit(
commentsHelper, maxWidth, state, /* optBreakDoc= */ Optional.empty(), splits.get(0));
state = computeBreakAndSplit(
commentsHelper, maxWidth, state, /* optBreakDoc= */ Optional.empty(), splits.get(0));

// Handle following breaks and split.
for (int i = 0; i < breaks.size(); i++) {
state =
computeBreakAndSplit(
commentsHelper, maxWidth, state, Optional.of(breaks.get(i)), splits.get(i + 1));
state = computeBreakAndSplit(
commentsHelper, maxWidth, state, Optional.of(breaks.get(i)), splits.get(i + 1));
}
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.Multiset;
import com.google.common.collect.PeekingIterator;
import com.google.common.collect.Streams;
Expand Down Expand Up @@ -483,7 +484,7 @@ public boolean visitArrayInitializer(List<? extends ExpressionTree> expressions)
token("{");
builder.forcedBreak();
boolean first = true;
for (Iterable<? extends ExpressionTree> row : Iterables.partition(expressions, cols)) {
for (Iterable<? extends ExpressionTree> row : Lists.partition(expressions, cols)) {
if (!first) {
builder.forcedBreak();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,8 @@ public ImmutableList<Replacement> format(
ranges = offsetRanges(ranges, wrapper.offset);

String replacement = formatter.formatSource(wrapper.contents.toString(), ranges);
replacement =
replacement.substring(
wrapper.offset,
replacement.length() - (wrapper.contents.length() - wrapper.offset - source.length()));
replacement = replacement.substring(
wrapper.offset, replacement.length() - (wrapper.contents.length() - wrapper.offset - source.length()));

return toReplacements(source, replacement).stream().filter(r -> rangeSet.encloses(r.getReplaceRange())).collect(
toImmutableList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static ClassTree getEnclosingTypeDeclaration(TreePath path) {
break;
}
}
throw new AssertionError();
throw new IllegalStateException();
}

/** Skips a single parenthesized tree. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public TyParseState next(JavaCaseFormat n) {
case UPPER_CAMEL:
return TyParseState.TYPE;
}
throw new AssertionError();
throw new IllegalStateException();
}
},

Expand All @@ -59,7 +59,7 @@ public TyParseState next(JavaCaseFormat n) {
case UPPER_CAMEL:
return TyParseState.TYPE;
}
throw new AssertionError();
throw new IllegalStateException();
}
},

Expand Down Expand Up @@ -92,7 +92,7 @@ public TyParseState next(JavaCaseFormat n) {
case UPPER_CAMEL:
return TyParseState.TYPE;
}
throw new AssertionError();
throw new IllegalStateException();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private String render(List<Token> input, int blockIndent) {
throw new AssertionError(token.getType());
}
}
throw new AssertionError();
throw new IllegalStateException();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private Type consumeToken() throws LexException {
} else if (input.tryConsumeRegex(LITERAL_PATTERN)) {
return LITERAL;
}
throw new AssertionError();
throw new IllegalStateException();
}

private boolean preserveExistingFormatting() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.palantir.javaformat.jupiter.ParameterizedClass;
import java.util.Arrays;
import org.junit.jupiter.api.TestTemplate;
Expand Down Expand Up @@ -77,7 +77,7 @@ public static Iterable<Object[]> parameters() {
"List<int @A [] @B []> xs;",
"List<int[] @A [][] @B []> xs;",
};
return Iterables.transform(Arrays.asList(inputs), input -> new Object[] {input});
return Lists.transform(Arrays.asList(inputs), input -> new Object[] {input});
}

private final String input;
Expand Down

0 comments on commit 6abfb0a

Please sign in to comment.