Skip to content

Commit b12cf6a

Browse files
Excavator: Upgrades Baseline to the latest version (#771)
1 parent 5d11ccc commit b12cf6a

24 files changed

+51
-46
lines changed

.baseline/checkstyle/checkstyle.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</module>
4444
<module name="LineLength"> <!-- Java Style Guide: No line-wrapping -->
4545
<property name="max" value="120"/>
46-
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
46+
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|\{@link"/>
4747
</module>
4848
<module name="TreeWalker">
4949
<module name="SuppressionCommentFilter"/> <!-- baseline-gradle: README.md -->
@@ -402,7 +402,9 @@
402402
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
403403
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
404404
</module>
405-
<module name="CyclomaticComplexity"/> <!-- Java Coding Guidelines: Reduce Cyclomatic Complexity -->
405+
<module name="CyclomaticComplexity"> <!-- Java Coding Guidelines: Reduce Cyclomatic Complexity -->
406+
<property name="switchBlockAsSingleDecisionPoint" value="true"/>
407+
</module>
406408
<module name="DesignForExtension"> <!-- Java Coding Guidelines: Design for extension -->
407409
<property name="ignoredAnnotations" value="ParameterizedTest, Test, Before, BeforeEach, After, AfterEach, BeforeClass, BeforeAll, AfterClass, AfterAll"/>
408410
</module>

.baseline/idea/intellij-java-palantir-style.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@
4444
<package name="" withSubpackages="true" static="false" />
4545
</value>
4646
</option>
47+
<!-- Should be a superset of https://github.com/google/error-prone/blob/c481b3f9c2da112db36ccfcbf64e755261a127ab/core/src/main/java/com/google/errorprone/bugpatterns/BadImport.java#L63 -->
4748
<DO_NOT_IMPORT_INNER>
4849
<CLASS name="Builder" />
50+
<CLASS name="BuilderFactory" />
4951
<CLASS name="Callback" />
5052
<CLASS name="Class" />
5153
<CLASS name="Entry" />
@@ -54,6 +56,7 @@
5456
<CLASS name="Type" />
5557
<CLASS name="Key" />
5658
<CLASS name="Id" />
59+
<CLASS name="Identifier" />
5760
<CLASS name="Provider" />
5861
</DO_NOT_IMPORT_INNER>
5962
</GroovyCodeStyleSettings>

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.5.0'
99
classpath 'com.gradle.publish:plugin-publish-plugin:1.2.0'
10-
classpath 'com.palantir.baseline:gradle-baseline-java:4.145.0'
10+
classpath 'com.palantir.baseline:gradle-baseline-java:5.13.0'
1111
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.12.0'
1212
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.12.0'
1313
classpath 'com.palantir.gradle.gitversion:gradle-git-version:3.0.0'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void add(DocBuilder builder) {
134134
builder.open(this);
135135
}
136136

137-
/** @see ImmutableOpenOp.Builder#Builder() */
137+
/** Builder @see ImmutableOpenOp.Builder#Builder(). */
138138
public static Builder builder() {
139139
return new Builder();
140140
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
/** An {@code OpsBuilder} creates a list of {@link Op}s, which is turned into a {@link Doc} by {@link DocBuilder}. */
4848
public final class OpsBuilder {
4949

50-
/** @return the actual size of the AST node at position, including comments. */
50+
/** 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);
5353
int start = startToken.getTok().getPosition();
@@ -66,7 +66,7 @@ public int actualSize(int position, int length) {
6666
return end - start;
6767
}
6868

69-
/** @return the start column of the token at {@code position}, including leading comments. */
69+
/** Return the start column of the token at {@code position}, including leading comments. */
7070
public Integer actualStartColumn(int position) {
7171
Input.Token startToken = input.getPositionTokenMap().get(position);
7272
int start = startToken.getTok().getPosition();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public abstract class Output extends InputOutput {
3030
/**
3131
* Output a string.
3232
*
33-
* @param state
33+
* @param state the current state
3434
* @param text the string
3535
* @param range the {@link Range} corresponding to the string
3636
*/

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ public abstract class Doc extends HasUniqueId {
3737
static final Range<Integer> EMPTY_RANGE = Range.closedOpen(-1, -1);
3838
static final DiscreteDomain<Integer> INTEGERS = DiscreteDomain.integers();
3939

40+
@SuppressWarnings("Immutable") // Effectively immutable
4041
private final ImmutableSupplier<Float> memoizedWidth = Suppliers.memoize(this::computeWidth)::get;
42+
43+
@SuppressWarnings("Immutable") // Effectively immutable
4144
private final ImmutableSupplier<String> memoizedFlat = Suppliers.memoize(this::computeFlat)::get;
45+
46+
@SuppressWarnings("Immutable") // Effectively immutable
4247
private final ImmutableSupplier<Range<Integer>> memoizedRange = Suppliers.memoize(this::computeRange)::get;
4348

4449
/**
@@ -51,7 +56,7 @@ final float getWidth() {
5156
}
5257

5358
/**
54-
* Return a {@code Doc}'s flat-string value; not defined (and never called) if the (@code Doc} contains forced
59+
* Return a {@code Doc}'s flat-string value; not defined (and never called) if the {@code Doc} contains forced
5560
* breaks.
5661
*
5762
* @return the flat-string value

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public final class Level extends Doc {
6060
private static final Collector<Level, ?, Optional<Level>> GET_LAST_COLLECTOR = Collectors.reducing((u, v) -> v);
6161

6262
private final List<Doc> docs = new ArrayList<>(); // The elements of the level.
63+
64+
@SuppressWarnings("Immutable") // Effectively immutable
6365
private final ImmutableSupplier<SplitsBreaks> memoizedSplitsBreaks =
6466
Suppliers.memoize(() -> splitByBreaks(docs))::get;
6567
/** The immutable characteristics of this level determined before the level contents are available. */
@@ -147,7 +149,7 @@ private Optional<Integer> tryToFitOnOneLine(int maxWidth, State state, Iterable<
147149
column = newWidth.get();
148150
continue;
149151
}
150-
column += doc.getWidth();
152+
column = (int) (column + doc.getWidth());
151153
}
152154
// Make an additional check that widthBeforeLastBreak fits in the column limit
153155
if (getColumnLimitBeforeLastBreak().isPresent()

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.palantir.javaformat.doc;
1818

19-
import com.google.common.base.Strings;
2019
import com.palantir.javaformat.BreakBehaviours;
2120
import com.palantir.javaformat.Indent;
2221
import com.palantir.javaformat.LastLevelBreakability;
@@ -94,6 +93,6 @@ public String visitLevel(Level level) {
9493
}
9594

9695
private void generateIndent(StringBuilder builder) {
97-
builder.append(Strings.repeat(" ", indent));
96+
builder.append(" ".repeat(indent));
9897
}
9998
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ FinishExplorationNode startExplorationNode(
5353
Optional<State> incomingState);
5454

5555
/**
56+
* Write the given level node
5657
* @param levelNodeId the unique ID of the {@link LevelNode}. There can be multiple LevelNodes per
5758
* {@link Level}.
5859
* @param parentExplorationId what exploration is this {@link LevelNode} a part of

0 commit comments

Comments
 (0)