Skip to content

Commit

Permalink
Excavator: Upgrades Baseline to the latest version (#1172)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored Nov 20, 2024
1 parent 0dd44af commit faf7a32
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildscript {
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.50.0'
classpath 'com.palantir.gradle.revapi:gradle-revapi:1.8.0'
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.50.0'
classpath 'com.palantir.suppressible-error-prone:gradle-suppressible-error-prone:1.6.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.7.0'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Optional<FormatterService> get(Project project, PalantirJavaFormatSettings setti
settings.injectedVersionIsOutdated()));
}

@SuppressWarnings("for-rollout:Slf4jLogsafeArgs")
private static Optional<FormatterService> createFormatter(FormatterCacheKey cacheKey) {
if (cacheKey.jdkMajorVersion.isEmpty()) {
return Optional.empty();
Expand Down Expand Up @@ -107,6 +108,7 @@ private static List<Path> getProvidedImplementationUrls(List<URI> implementation
return implementationClasspath.stream().map(Path::of).collect(Collectors.toList());
}

@SuppressWarnings("for-rollout:Slf4jLogsafeArgs")
private static List<Path> getBundledImplementationUrls() {
// Load from the jars bundled with the plugin.
IdeaPluginDescriptor ourPlugin = Preconditions.checkNotNull(
Expand All @@ -116,6 +118,7 @@ private static List<Path> getBundledImplementationUrls() {
return listDirAsUrlsUnchecked(implDir);
}

@SuppressWarnings("for-rollout:Slf4jLogsafeArgs")
private static List<Path> getImplementationUrls(
Optional<List<URI>> implementationClassPath, boolean useBundledImplementation) {
if (useBundledImplementation) {
Expand Down Expand Up @@ -163,6 +166,7 @@ private static OptionalInt parseSdkJavaVersion(Sdk sdk) {
return parseSdkJavaVersion(version);
}

@SuppressWarnings("for-rollout:Slf4jLogsafeArgs")
@VisibleForTesting
static OptionalInt parseSdkJavaVersion(String version) {
int indexOfVersionDelimiter = version.indexOf('.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ class PalantirJavaFormatConfigurable extends BaseConfigurable implements Searcha
private final Project project;
private JPanel panel;
private JCheckBox enable;

@SuppressWarnings("for-rollout:RawTypes")
private JComboBox styleComboBox;

private JLabel formatterVersion;
private JLabel pluginVersion;

@SuppressWarnings("for-rollout:NullAway")
public PalantirJavaFormatConfigurable(Project project) {
this.project = project;
}
Expand Down Expand Up @@ -133,6 +137,7 @@ private void createUIComponents() {
*
* @noinspection ALL
*/
@SuppressWarnings("for-rollout:InvalidBlockTag")
private void $$$setupUI$$$() {
createUIComponents();
panel = new JPanel();
Expand Down Expand Up @@ -281,6 +286,7 @@ private void createUIComponents() {
}

/** @noinspection ALL */
@SuppressWarnings({"for-rollout:InvalidBlockTag", "for-rollout:MissingSummary"})
public JComponent $$$getRootComponent$$$() {
return panel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,28 @@
import java.util.stream.Stream;
import javax.annotation.Nullable;

@SuppressWarnings("for-rollout:SameNameButDifferent")
@State(
name = "PalantirJavaFormatSettings",
storages = {@Storage("palantir-java-format.xml")})
class PalantirJavaFormatSettings implements PersistentStateComponent<PalantirJavaFormatSettings.State> {

@SuppressWarnings("for-rollout:SameNameButDifferent")
private State state = new State();

static PalantirJavaFormatSettings getInstance(Project project) {
return ServiceManager.getService(project, PalantirJavaFormatSettings.class);
}

@SuppressWarnings("for-rollout:SameNameButDifferent")
@Nullable
@Override
public State getState() {
return state;
}

@Override
public void loadState(State state) {
public void loadState(@SuppressWarnings("for-rollout:SameNameButDifferent") State state) {
this.state = state;
}

Expand Down Expand Up @@ -144,6 +147,7 @@ public void setImplementationClassPath(@Nullable List<String> value) {
.map(strings -> strings.stream().map(URI::create).collect(Collectors.toList()));
}

@SuppressWarnings("for-rollout:NullAway")
public List<String> getImplementationClassPath() {
return implementationClassPath
.map(paths -> paths.stream().map(URI::toString).collect(Collectors.toList()))
Expand All @@ -161,6 +165,7 @@ public void setEnabled(@Nullable String enabledStr) {
}
}

@SuppressWarnings("for-rollout:NullAway")
public String getEnabled() {
switch (enabled) {
case ENABLED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static int hasNewlineAt(String input, int idx) {
}

/** Returns the terminating line break in the input, or {@code null} if the input does not end in a break. */
@SuppressWarnings("for-rollout:NullAway")
public static String getLineEnding(String input) {
for (String b : BREAKS) {
if (input.endsWith(b)) {
Expand Down Expand Up @@ -158,6 +159,7 @@ private static final class LineIterator implements Iterator<String> {
private final String input;
private final Iterator<Integer> indices;

@SuppressWarnings("for-rollout:NullAway")
private LineIterator(String input) {
this.input = input;
this.indices = lineOffsetIterator(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public String visitBreak(Break doc) {
return sb.toString();
}

@SuppressWarnings("for-rollout:NullAway")
@Override
public String visitLevel(Level level) {
if (level.getFlat().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ FinishExplorationNode startExplorationNode(
String getOutput();
}

@SuppressWarnings("for-rollout:NullAway")
public static ExplorationNode createRoot(Sink sink) {
return new ExplorationNodeImpl(null, "(initial node)", sink, 0, Optional.empty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ final class CommandLineOptionsParser {
Splitter.on(CharMatcher.breakingWhitespace()).omitEmptyStrings().trimResults();

/** Parses {@link CommandLineOptions}. */
@SuppressWarnings("for-rollout:NullAway")
static CommandLineOptions parse(Iterable<String> options) {
CommandLineOptions.Builder optionsBuilder = CommandLineOptions.builder();
List<String> expandedOptions = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public String toString() {
* @param text the input text
* @throws FormatterException if the input cannot be parsed
*/
@SuppressWarnings("for-rollout:NullAway")
public JavaInput(String text) throws FormatterException {
this.text = checkNotNull(text);
setLines(ImmutableList.copyOf(Newlines.lineIterator(text)));
Expand Down Expand Up @@ -344,6 +345,7 @@ private ImmutableList<Tok> buildToks(String text) throws FormatterException {
* @param stopTokens a set of tokens which should cause lexing to stop. If one of these is found, the returned list
* will include tokens up to but not including that token.
*/
@SuppressWarnings("for-rollout:NullAway")
static ImmutableList<Tok> buildToks(String text, ImmutableSet<TokenKind> stopTokens) throws FormatterException {
stopTokens = ImmutableSet.<TokenKind>builder()
.addAll(stopTokens)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@ void visitVariables(List<VariableTree> fragments, DeclarationKind declarationKin
}
}

@SuppressWarnings("for-rollout:NullAway")
private TypeWithDims variableFragmentDims(boolean first, int leadingDims, Tree type) {
if (type == null) {
return null;
Expand Down Expand Up @@ -1381,6 +1382,7 @@ public Void visitAnnotatedType(AnnotatedTypeTree node, Void unused) {

protected static final long RECORD = 1L << 61;

@SuppressWarnings("for-rollout:NullAway")
@Override
public Void visitMethod(MethodTree node, Void unused) {
sync(node);
Expand Down Expand Up @@ -2997,6 +2999,7 @@ private ExpressionTree getArrayBase(ExpressionTree node) {
return node;
}

@SuppressWarnings("for-rollout:NullAway")
private ExpressionTree getMethodReceiver(MethodInvocationTree methodInvocation) {
ExpressionTree select = methodInvocation.getMethodSelect();
return select instanceof MemberSelectTree ? ((MemberSelectTree) select).getExpression() : null;
Expand Down Expand Up @@ -3328,6 +3331,7 @@ static int rowLength(List<? extends ExpressionTree> row) {
return size;
}

@SuppressWarnings("for-rollout:NullAway")
private Integer actualColumn(ExpressionTree expression) {
Map<Integer, Integer> positionToColumnMap = builder.getInput().getPositionToColumnMap();
return positionToColumnMap.get(builder.actualStartColumn(getStartPosition(expression)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void flush() {
*
* @return a list of {@link Replacement}s, sorted by start index, without overlaps
*/
@SuppressWarnings("for-rollout:NullAway")
public ImmutableList<Replacement> getFormatReplacements(RangeSet<Integer> iRangeSet0) {
ImmutableList.Builder<Replacement> result = ImmutableList.builder();
Map<Integer, Range<Integer>> kToJ = JavaOutput.makeKToIJ(this);
Expand Down Expand Up @@ -212,6 +213,7 @@ public ImmutableList<Replacement> getFormatReplacements(RangeSet<Integer> iRange
replaceFrom--;
}

@SuppressWarnings("for-rollout:NullAway")
int i = kToJ.get(startTok.getIndex()).lowerEndpoint();
// Include leading blank lines from the formatted output, unless the formatted range
// starts at the beginning of the file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public String stringVal() {
}

/** Lex the input and return a list of {@link RawTok}s. */
@SuppressWarnings("for-rollout:NullAway")
public static ImmutableList<RawTok> getTokens(String source, Context context, Set<TokenKind> stopTokens) {
if (source == null) {
return ImmutableList.of();
Expand Down Expand Up @@ -154,6 +155,7 @@ static class CommentWithTextAndPosition implements Comment {
private final AccessibleReader reader;
private final CommentStyle style;

@SuppressWarnings("for-rollout:NullAway")
private String text = null;

public CommentWithTextAndPosition(int pos, int endPos, AccessibleReader reader, CommentStyle style) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ public final class JsonSink implements Sink {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper().registerModule(new Jdk8Module());

private final Map<Integer, ArrayNode> childrenMap = new HashMap<>();

@SuppressWarnings("for-rollout:NullAway")
private ObjectNode rootNode;

@SuppressWarnings("for-rollout:NullAway")
@Override
public FinishExplorationNode startExplorationNode(
int exporationId,
Expand Down Expand Up @@ -68,6 +71,7 @@ public FinishExplorationNode startExplorationNode(

@Override
public FinishLevelNode writeLevelNode(int levelNodeId, int parentExplorationId, State incomingState, Level level) {
@SuppressWarnings("for-rollout:NullAway")
ObjectNode json = childrenMap.get(parentExplorationId).addObject();
json.put("type", "level");
json.put("id", levelNodeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private static void addTrivia(StringBuilder replacement, ImmutableList<? extends
/**
* Returns the given token as a {@link javax.lang.model.element.Modifier}, or {@code null} if it is not a modifier.
*/
@SuppressWarnings("for-rollout:NullAway")
private static Modifier asModifier(Token token) {
TokenKind kind = ((JavaInput.Tok) token.getTok()).kind();
if (kind != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public Void visitCase(CaseTree tree, Void unused) {

private static final Method CASE_TREE_GET_LABELS = caseTreeGetLabels();

@SuppressWarnings("for-rollout:NullAway")
private static Method caseTreeGetLabels() {
try {
return CaseTree.class.getMethod("getLabels");
Expand All @@ -125,6 +126,7 @@ private static Method caseTreeGetLabels() {
}
}

@SuppressWarnings("for-rollout:VoidUsed")
@Override
public Void scan(Tree tree, Void unused) {
if (tree == null) {
Expand Down Expand Up @@ -182,6 +184,7 @@ public ReferenceScanner(long basePos) {
this.basePos = basePos;
}

@SuppressWarnings("for-rollout:VoidUsed")
@Override
public Void visitIdentifier(IdentifierTree node, Void aVoid) {
usedInJavadoc.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static Name getMethodName(MethodInvocationTree methodInvocation) {
}

/** Returns the receiver of a qualified method invocation expression, or {@code null}. */
@SuppressWarnings("for-rollout:NullAway")
static ExpressionTree getMethodReceiver(MethodInvocationTree methodInvocation) {
ExpressionTree select = methodInvocation.getMethodSelect();
return select instanceof MemberSelectTree ? ((MemberSelectTree) select).getExpression() : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ protected List<? extends Tree> getPermitsClause(ClassTree node) {
}
}

@SuppressWarnings("for-rollout:NullAway")
@Override
public Void visitBindingPattern(BindingPatternTree node, Void unused) {
sync(node);
Expand Down Expand Up @@ -326,6 +327,7 @@ public Void visitLambdaExpression(LambdaExpressionTree node, Void unused) {
return null;
}

@SuppressWarnings("for-rollout:NullAway")
private static Method maybeGetMethod(Class<?> c, String name) {
try {
return c.getMethod(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ private static ImmutableList<Token> deindentPreCodeBlocks(List<Token> input) {
return output.build();
}

@SuppressWarnings("for-rollout:NullAway")
private static void deindentPreCodeBlock(ImmutableList.Builder<Token> output, PeekingIterator<Token> tokens) {
Deque<Token> saved = new ArrayDeque<>();
output.add(new Token(LITERAL, tokens.next().getValue().trim()));
Expand Down

0 comments on commit faf7a32

Please sign in to comment.