Skip to content

Commit 2edd7d9

Browse files
committed
Remove every @SuppressWarnings but Immutable's
Of the 110 annotations 105 hid nothing. 94 named their checks with palantir-baseline's for-rollout: prefix, which plain Error Prone does not take for the check's name: NullAway and the rest reported those lines all along. Others named checks this build does not run (TooManyArguments, ImmutablesStyle), IntelliJ inspections, or javac's unchecked lint, which is off. Without UnicodeEscape's, its one finding shows. The five on Doc's and Level's memoized suppliers stay: Immutable is an error, and the suppliers are mutable caches that the check rightly rejects. They need their own change.
1 parent f2baf3d commit 2edd7d9

36 files changed

Lines changed: 1 addition & 106 deletions

‎gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/FormatDiff.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ private static Path gitTopLevelDir(Path dir) throws IOException, InterruptedExce
129129
return Paths.get(gitCommand(dir, "git", "rev-parse", "--show-toplevel"));
130130
}
131131

132-
@SuppressWarnings("for-rollout:DefaultCharset")
133132
private static String gitCommand(Path dir, String... args) throws IOException, InterruptedException {
134133
Process process =
135134
new ProcessBuilder().command(args).directory(dir.toFile()).start();

‎gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/FormatterServiceLoader.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public static synchronized FormatterService load(Collection<File> jars) {
6969
return LOADED.computeIfAbsent(key, _key -> loadUncached(jars));
7070
}
7171

72-
@SuppressWarnings("for-rollout:NullAway")
7372
private static FormatterService loadUncached(Collection<File> jars) {
7473
URL[] jarUris = jars.stream()
7574
.map(file -> {

‎gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/PalantirJavaFormatProviderPlugin.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public final class PalantirJavaFormatProviderPlugin implements Plugin<Project> {
2525

2626
static final String CONFIGURATION_NAME = "palantirJavaFormat";
2727

28-
@SuppressWarnings({"for-rollout:GradleTypesAsFields", "for-rollout:NonAbstractGradleType"})
2928
@Override
3029
public void apply(Project rootProject) {
3130
Preconditions.checkState(
@@ -34,7 +33,6 @@ public void apply(Project rootProject) {
3433

3534
rootProject.getPluginManager().apply(NativeImageFormatProviderPlugin.class);
3635

37-
@SuppressWarnings("for-rollout:ConfigurationAvoidanceRegistration")
3836
Configuration configuration = rootProject.getConfigurations().create(CONFIGURATION_NAME, conf -> {
3937
conf.setDescription("Internal configuration for resolving the open-java-format implementation");
4038
conf.setCanBeConsumed(false);

‎gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/spotless/NativePalantirJavaFormatStep.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ static class State implements Serializable {
4747

4848
// Kept for state serialization purposes.
4949
// For more details, see PalantirJavaFormatStep.State#jarSignature
50-
@SuppressWarnings({"unused", "FieldCanBeLocal"})
5150
private FileSignature execSignature;
5251

5352
private final transient Supplier<File> execSupplier;
5453

55-
@SuppressWarnings("for-rollout:NullAway")
5654
State(Supplier<File> supplier) {
5755
this.execSupplier = supplier;
5856
}

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,25 @@
3737

3838
import static java.util.Optional.ofNullable;
3939

40-
@SuppressWarnings("for-rollout:SameNameButDifferent")
4140
@State(
4241
name = "PalantirJavaFormatSettings",
4342
storages = {@Storage("open-java-format.xml")})
4443
public class PalantirJavaFormatSettings implements PersistentStateComponent<PalantirJavaFormatSettings.State> {
4544

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

4947
static PalantirJavaFormatSettings getInstance(Project project) {
5048
return project.getService(PalantirJavaFormatSettings.class);
5149
}
5250

53-
@SuppressWarnings("for-rollout:SameNameButDifferent")
5451
@Nullable
5552
@Override
5653
public State getState() {
5754
return state;
5855
}
5956

6057
@Override
61-
public void loadState(@SuppressWarnings("for-rollout:SameNameButDifferent") State state) {
58+
public void loadState(State state) {
6259
this.state = state;
6360
}
6461

@@ -167,7 +164,6 @@ public void setImplementationClassPath(@Nullable List<String> value) {
167164
.map(strings -> strings.stream().map(URI::create).collect(Collectors.toList()));
168165
}
169166

170-
@SuppressWarnings("for-rollout:NullAway")
171167
public List<String> getImplementationClassPath() {
172168
return implementationClassPath
173169
.map(paths -> paths.stream().map(URI::toString).collect(Collectors.toList()))
@@ -185,7 +181,6 @@ public void setEnabled(@Nullable String enabledStr) {
185181
}
186182
}
187183

188-
@SuppressWarnings("for-rollout:NullAway")
189184
public String getEnabled() {
190185
return switch (enabled) {
191186
case ENABLED -> "true";

‎open-java-format-idea-plugin/src/test/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingServiceTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ private PsiFile createPsiFile(String path, String... contents) throws IOExceptio
127127
}
128128

129129
private static final class DelegatingFormatter extends PalantirJavaFormatFormattingService {
130-
@SuppressWarnings("DataFlowIssue")
131130
public DelegatingFormatter() {
132131
this.setPluginDescriptor(FormattingService.EP_NAME
133132
.findExtension(PalantirJavaFormatFormattingService.class)

‎open-java-format-jdk-bootstrap/src/main/java/com/palantir/javaformat/bootstrap/BootstrappingFormatterService.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ private ImmutableList<Replacement> getFormatReplacementsInternal(String input, C
8686
/* outputReplacements= */ true,
8787
ranges.stream().map(RangeUtils::toStringRange).collect(Collectors.toList()));
8888

89-
@SuppressWarnings("for-rollout:NullAway")
9089
Optional<String> output =
9190
FormatterCommandRunner.runWithStdin(command.toArgs(), input, Optional.of(jdkPath.getParent()));
9291
if (output.isEmpty() || output.get().isEmpty()) {

‎open-java-format/src/main/java/com/palantir/javaformat/Newlines.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public static int hasNewlineAt(String input, int idx) {
5353
}
5454

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

163-
@SuppressWarnings("for-rollout:NullAway")
164162
private LineIterator(String input) {
165163
this.input = input;
166164
this.indices = lineOffsetIterator(input);

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,13 @@ public final class OpsBuilder {
5050
/** 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);
53-
@SuppressWarnings("for-rollout:NullAway")
5453
int start = startToken.getTok().getPosition();
5554
for (Input.Tok tok : startToken.getToksBefore()) {
5655
if (tok.isComment()) {
5756
start = Math.min(start, tok.getPosition());
5857
}
5958
}
6059
Input.Token endToken = input.getPositionTokenMap().get(position + length - 1);
61-
@SuppressWarnings("for-rollout:NullAway")
6260
int end = endToken.getTok().getPosition() + endToken.getTok().length();
6361
for (Input.Tok tok : endToken.getToksAfter()) {
6462
if (tok.isComment()) {
@@ -71,7 +69,6 @@ public int actualSize(int position, int length) {
7169
/** Return the start column of the token at {@code position}, including leading comments. */
7270
public Integer actualStartColumn(int position) {
7371
Input.Token startToken = input.getPositionTokenMap().get(position);
74-
@SuppressWarnings("for-rollout:NullAway")
7572
int start = startToken.getTok().getPosition();
7673
int line0 = input.getLineNumber(start);
7774
for (Input.Tok tok : startToken.getToksBefore()) {

‎open-java-format/src/main/java/com/palantir/javaformat/doc/Comment.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ protected Range<Integer> computeRange() {
157157
public State computeBreaks(
158158
CommentsHelper commentsHelper, int maxWidth, State state, Obs.ExplorationNode observationNode) {
159159
String text = commentsHelper.rewrite(tok, maxWidth, state.column());
160-
@SuppressWarnings("for-rollout:NullAway")
161160
int lastLineStart = Iterators.getLast(Newlines.lineOffsetIterator(text));
162161
int lastLineLength = text.length() - lastLineStart;
163162
// rewrite() indents every line after the first to state.column(), so after a comment that spans lines the

0 commit comments

Comments
 (0)