Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excavator: Upgrades Baseline to the latest version #507

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.2.1'
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.2.0'
classpath 'com.palantir.gradle.revapi:gradle-revapi:1.5.0'
classpath 'com.palantir.baseline:gradle-baseline-java:3.96.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.8.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.3.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.3'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ public Indent zeroIndent() {
}

@Override
public void reformatNewlyAddedElement(ASTNode block, ASTNode addedElement) throws IncorrectOperationException {
delegate.reformatNewlyAddedElement(block, addedElement);
public void reformatNewlyAddedElement(ASTNode parent, ASTNode addedElement) throws IncorrectOperationException {
delegate.reformatNewlyAddedElement(parent, addedElement);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
import com.palantir.javaformat.java.FormatterDiagnostic;
import com.palantir.javaformat.java.InputMetadata;
import com.palantir.javaformat.java.InputMetadataBuilder;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -494,8 +498,13 @@ private static int getI(Input.Token token) {

private static final NonBreakingSpace SPACE = NonBreakingSpace.make();

@Value.Immutable
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@Value.Style(overshadowImplementation = true)
@interface OpsOutputStyle {}

@OpsOutputStyle
@Value.Immutable
public interface OpsOutput {
ImmutableList<Op> ops();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
import com.palantir.javaformat.doc.Obs.ExplorationNode;
import com.palantir.javaformat.doc.Obs.LevelNode;
import com.palantir.javaformat.doc.StartsWithBreakVisitor.Result;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -754,8 +758,13 @@ public String toString() {
.toString();
}

@Value.Immutable
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@Value.Style(overshadowImplementation = true)
@interface SplitsBreaksStyle {}

@SplitsBreaksStyle
@Value.Immutable
interface SplitsBreaks {
/** Groups of {@link Doc}s that are children of the current {@link Level}, separated by {@link Break}s. */
ImmutableList<ImmutableList<Doc>> splits();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
import com.palantir.javaformat.Indent;
import fj.data.Set;
import fj.data.TreeMap;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.immutables.value.Value;
import org.immutables.value.Value.Parameter;

/** State for writing. */
// Automatically suppressed to unblock enforcement in new code
@SuppressWarnings("ImmutablesStyle")
@Value.Immutable
@Value.Style(overshadowImplementation = true)
@JsonSerialize(as = ImmutableState.class)
Expand Down Expand Up @@ -219,8 +225,13 @@ public static Builder builder() {
return new Builder();
}

@Value.Immutable
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@Value.Style(overshadowImplementation = true)
@interface BreakStateStyle {}

@BreakStateStyle
@Value.Immutable
@JsonSerialize(as = ImmutableBreakState.class)
interface BreakState {
@Parameter
Expand All @@ -230,16 +241,26 @@ interface BreakState {
int newIndent();
}

@Value.Immutable
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@Value.Style(overshadowImplementation = true)
@interface LevelStateStyle {}

@LevelStateStyle
@Value.Immutable
interface LevelState {
/** True if the entire {@link Level} fits on one line. */
@Parameter
boolean oneLine();
}

@Value.Immutable
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@Value.Style(overshadowImplementation = true)
@interface TokStateStyle {}

@TokStateStyle
@Value.Immutable
interface TokState {
@Parameter
String text();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* Records metadata about the input, namely existing blank lines that we might want to preserve, as well as what ranges
* can be partially formatted.
*/
// Automatically suppressed to unblock enforcement in new code
@SuppressWarnings("ImmutablesStyle")
@Immutable
@Value.Immutable
@Value.Style(overshadowImplementation = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class JsonSink implements Sink {

@Override
public FinishExplorationNode startExplorationNode(
int explorationId,
int exporationId,
OptionalInt parentLevelId,
String humanDescription,
int startColumn,
Expand All @@ -51,13 +51,13 @@ public FinishExplorationNode startExplorationNode(
json = rootNode = OBJECT_MAPPER.createObjectNode();
}
json.put("type", "exploration");
json.put("id", explorationId);
json.put("id", exporationId);
parentLevelId.ifPresent(id -> json.put("parentId", id));
json.put("humanDescription", humanDescription);
// The column where we started off this exploration. Necessary to correctly indent the level.
json.put("startColumn", startColumn);
incomingState.ifPresent(state -> json.set("incomingState", OBJECT_MAPPER.valueToTree(state)));
createChildrenNode(explorationId, json);
createChildrenNode(exporationId, json);
return (parentLevel, newState) -> {
ObjectNode resultNode = OBJECT_MAPPER.createObjectNode();
json.set("result", resultNode);
Expand Down