Skip to content

Commit b3628e2

Browse files
author
Vincent Potucek
committed
[prone] diable warning CollectorMutability, fix warning MissingOverride
- #2745 Signed-off-by: Vincent Potucek <[email protected]>
1 parent e4edf85 commit b3628e2

File tree

4 files changed

+59
-14
lines changed

4 files changed

+59
-14
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414
jobs:
15-
sanityCheck:
15+
sanity-check:
1616
runs-on: ubuntu-latest
1717
env:
1818
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
@@ -35,7 +35,7 @@ jobs:
3535
- name: assemble testClasses
3636
run: ./gradlew assemble testClasses
3737
build:
38-
needs: sanityCheck
38+
needs: sanity-check
3939
strategy:
4040
fail-fast: false
4141
matrix:
@@ -107,7 +107,7 @@ jobs:
107107
# Status check that is required in branch protection rules.
108108
final-status:
109109
needs:
110-
- sanityCheck
110+
- sanity-check
111111
- build
112112
runs-on: ubuntu-latest
113113
if: always()

gradle/error-prone.gradle

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
apply plugin: 'net.ltgt.errorprone'
1+
import static java.lang.System.getenv
22

3-
dependencies {
4-
errorprone('com.google.errorprone:error_prone_core:2.42.0')
5-
errorprone('tech.picnic.error-prone-support:error-prone-contrib:0.26.0')
6-
}
3+
apply plugin: 'net.ltgt.errorprone'
74

85
tasks.withType(JavaCompile).configureEach {
96
options.errorprone {
10-
disable( // consider fix, or reasoning.
7+
disableAllWarnings = true // https://github.com/diffplug/spotless/issues/2745 https://github.com/google/error-prone/issues/5365
8+
disable(
9+
// consider fix, or reasoning.
10+
'AnnotateFormatMethod', // We don`t want to use ErrorProne's annotations.
11+
'CheckReturnValue', // We don`t want to use ErrorProne's annotations.
12+
'CollectorMutability', // for freedom global exclude, might whitelist. https://github.com/diffplug/spotless/pull/2744#discussion_r2553042130
13+
'DoNotCallSuggester', // We don`t want to use ErrorProne's annotations.
1114
'FunctionalInterfaceMethodChanged',
15+
'ImmutableEnumChecker', // We don`t want to use ErrorProne's annotations.
16+
'InlineMeSuggester', // We don`t want to use ErrorProne's annotations.
1217
'JavaxInjectOnAbstractMethod',
1318
'OverridesJavaxInjectableMethod',
19+
'ReturnValueIgnored', // We don`t want to use ErrorProne's annotations.
20+
// bug
21+
'FieldMissingNullable',
22+
'Slf4jLogStatement',
23+
'Slf4jLoggerDeclaration',
24+
'Var'
1425
)
1526
error(
1627
'AmbiguousJsonCreator',
@@ -26,6 +37,7 @@ tasks.withType(JavaCompile).configureEach {
2637
'IdentityConversion',
2738
'ImmutablesSortedSetComparator',
2839
'IsInstanceLambdaUsage',
40+
'MissingOverride',
2941
'MockitoMockClassReference',
3042
'MockitoStubbing',
3143
'NestedOptionals',
@@ -41,10 +53,22 @@ tasks.withType(JavaCompile).configureEach {
4153
)
4254
// bug: this only happens when the file is dirty.
4355
// might be an up2date (caching) issue, as file is currently in corrupt state.
44-
// ForbidGradleInternal(import org.gradle.api.internal.project.ProjectInternal;)
45-
errorproneArgs.add('-XepExcludedPaths:' +
46-
'.*/SelfTest.java|' +
47-
'.*/GradleIntegrationHarness.java'
56+
// ForbidGradleInternal(import
57+
excludedPaths.set(
58+
'.*/GradleIntegrationHarness.java|'+
59+
'.*/SelfTest.java'
4860
)
61+
if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) {
62+
errorproneArgs.addAll(
63+
'-XepPatchLocation:IN_PLACE', // how to prevent/ignore? @CanIgnoreReturnValue
64+
'-XepPatchChecks:' +
65+
'MissingOverride'
66+
)
67+
}
4968
}
5069
}
70+
71+
dependencies {
72+
errorprone('com.google.errorprone:error_prone_core:2.42.0')
73+
errorprone('tech.picnic.error-prone-support:error-prone-contrib:0.26.0')
74+
}

lib-extra/src/jdt/java/com/diffplug/spotless/extra/glue/jdt/EclipseJdtSortMembers.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,64 +98,84 @@ private static class Buffer implements IBuffer {
9898
this.contents = contents;
9999
}
100100

101+
@Override
101102
public void addBufferChangedListener(IBufferChangedListener listener) {}
102103

104+
@Override
103105
public void append(char[] text) {}
104106

107+
@Override
105108
public void append(String text) {}
106109

110+
@Override
107111
public void close() {}
108112

113+
@Override
109114
public char getChar(int position) {
110115
return '\u0000';
111116
}
112117

118+
@Override
113119
public char[] getCharacters() {
114120
return contents.toCharArray();
115121
}
116122

123+
@Override
117124
public String getContents() {
118125
return contents;
119126
}
120127

128+
@Override
121129
public int getLength() {
122130
return 0;
123131
}
124132

133+
@Override
125134
public IOpenable getOwner() {
126135
return null;
127136
}
128137

138+
@Override
129139
public String getText(int offset, int length) {
130140
return null;
131141
}
132142

143+
@Override
133144
public IResource getUnderlyingResource() {
134145
return null;
135146
}
136147

148+
@Override
137149
public boolean hasUnsavedChanges() {
138150
return false;
139151
}
140152

153+
@Override
141154
public boolean isClosed() {
142155
return false;
143156
}
144157

158+
@Override
145159
public boolean isReadOnly() {
146160
return true;
147161
}
148162

163+
@Override
149164
public void removeBufferChangedListener(IBufferChangedListener listener) {}
150165

166+
@Override
151167
public void replace(int position, int length, char[] text) {}
152168

169+
@Override
153170
public void replace(int position, int length, String text) {}
154171

172+
@Override
155173
public void save(IProgressMonitor progress, boolean force) {}
156174

175+
@Override
157176
public void setContents(char[] contents) {}
158177

178+
@Override
159179
public void setContents(String contents) {
160180
this.contents = contents;
161181
}

lib/src/jackson/java/com/diffplug/spotless/glue/yaml/JacksonYamlFormatterFunc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2023 DiffPlug
2+
* Copyright 2021-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@ public JacksonYamlFormatterFunc(JacksonYamlConfig jacksonConfig) {
4343
}
4444
}
4545

46+
@Override
4647
protected JsonFactory makeJsonFactory() {
4748
YAMLFactoryBuilder yamlFactoryBuilder = new YAMLFactoryBuilder(new YAMLFactory());
4849

0 commit comments

Comments
 (0)