-
Notifications
You must be signed in to change notification settings - Fork 39
/
checkstyle-init.patch
189 lines (175 loc) · 9.3 KB
/
checkstyle-init.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
--- a/pom.xml
+++ b/pom.xml
@@ -368,6 +368,12 @@
<version>1.4.4</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>3.27.0<!-- Renovate: org.assertj:assertj-bom --></version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
@@ -2421,9 +2427,13 @@
<compilerArgs>
<arg>-Xpkginfo:always</arg>
<arg>-XDcompilePolicy=simple</arg>
+ <!-- XXX: Drop this flag once the project uses Error Prone 2.36.0+ by default. -->
+ <arg>--should-stop=ifError=FLOW</arg>
<arg>
-Xplugin:ErrorProne ${error-prone.configuration-args}
</arg>
+ <arg>-Xmaxwarns</arg>
+ <arg>1000000</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
@@ -2436,6 +2446,11 @@
<artifactId>error-prone-contrib</artifactId>
<version>${error-prone-support.version}</version>
</path>
+ <path>
+ <groupId>tech.picnic.error-prone-support</groupId>
+ <artifactId>refaster-runner</artifactId>
+ <version>${error-prone-support.version}</version>
+ </path>
</annotationProcessorPaths>
</configuration>
</execution>
@@ -2476,11 +2491,14 @@
<compilerArgs>
<arg>-Xpkginfo:always</arg>
<arg>-XDcompilePolicy=simple</arg>
+ <!-- XXX: Drop this flag once the project uses Error Prone 2.36.0+ by default. -->
+ <arg>--should-stop=ifError=FLOW</arg>
<arg>
-Xplugin:ErrorProne \
- -XepExcludedPaths:.*[\\/]resources[\\/].* \
${error-prone.configuration-args}
</arg>
+ <arg>-Xmaxwarns</arg>
+ <arg>1000000</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
@@ -2493,6 +2511,11 @@
<artifactId>error-prone-contrib</artifactId>
<version>${error-prone-support.version}</version>
</path>
+ <path>
+ <groupId>tech.picnic.error-prone-support</groupId>
+ <artifactId>refaster-runner</artifactId>
+ <version>${error-prone-support.version}</version>
+ </path>
</annotationProcessorPaths>
</configuration>
</execution>
--- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/FileNameTest.java
+++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/FileNameTest.java
@@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test;
import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
+// This class is referenced from another package.
+@SuppressWarnings("JUnitClassModifiers")
public class FileNameTest extends AbstractGoogleModuleTestSupport {
@Override
--- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/SourceFileStructureTest.java
+++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/SourceFileStructureTest.java
@@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test;
import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
+// This class is referenced from another package.
+@SuppressWarnings("JUnitClassModifiers")
public class SourceFileStructureTest extends AbstractGoogleModuleTestSupport {
@Override
--- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/PackageStatementTest.java
+++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/PackageStatementTest.java
@@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test;
import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
+// This class is referenced from another package.
+@SuppressWarnings("JUnitClassModifiers")
public class PackageStatementTest extends AbstractGoogleModuleTestSupport {
@Override
--- a/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java
@@ -63,6 +63,8 @@ public final class DetailNodeTreeStringPrinter {
* @return DetailNode tree
* @throws IllegalArgumentException if there is an error parsing the Javadoc.
*/
+ // Invoking `getParseErrorMessage` requires that `status.getParseErrorMessage()` is `null`.
+ @SuppressWarnings("CheckArgumentWithMessage")
public static DetailNode parseJavadocAsDetailNode(DetailAST blockComment) {
final JavadocDetailNodeParser parser = new JavadocDetailNodeParser();
final ParseStatus status = parser.parseJavadocAsDetailNode(blockComment);
--- a/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java
@@ -157,6 +157,9 @@ public class SarifLogger extends AbstractAutomaticBean implements AuditListener
@Override
public void auditFinished(AuditEvent event) {
final String version = SarifLogger.class.getPackage().getImplementationVersion();
+ // Here `version` may be `null`, while `String#replace` requires non-`null` arguments.
+ // XXX: Investigate better nullness handling by `IdentityConversion`.
+ @SuppressWarnings("IdentityConversion")
final String rendered = report
.replace(VERSION_PLACEHOLDER, String.valueOf(version))
.replace(RESULTS_PLACEHOLDER, String.join(",\n", results));
--- a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
@@ -97,6 +97,8 @@ import de.thetaphi.forbiddenapis.SuppressForbidden;
* @noinspectionreason ClassWithTooManyDependencies - complex tests require a large number
* of imports
*/
+// This class is referenced from another package.
+@SuppressWarnings("JUnitClassModifiers")
public class CheckerTest extends AbstractModuleTestSupport {
@TempDir
--- a/src/test/java/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java
@@ -47,6 +47,8 @@ import com.puppycrawl.tools.checkstyle.internal.utils.TestUtil;
/**
* Unit test for ConfigurationLoader.
*/
+// This class is referenced from another package.
+@SuppressWarnings("JUnitClassModifiers")
public class ConfigurationLoaderTest extends AbstractPathTestSupport {
@Override
--- a/src/test/java/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java
@@ -98,6 +98,8 @@ public class PackageObjectFactoryTest {
public void testCtorNullPackageException1() {
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try {
+ // XXX: Don't suggest `ImmutableSet.of(elem)` for nullable `elem`.
+ @SuppressWarnings("ImmutableSetOf1")
final Object test = new PackageObjectFactory(Collections.singleton(null), classLoader);
assertWithMessage("Exception is expected but got " + test).fail();
}
@@ -126,6 +128,8 @@ public class PackageObjectFactoryTest {
public void testCtorNullPackageException3() {
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try {
+ // XXX: Don't suggest `ImmutableSet.of(elem)` for nullable `elem`.
+ @SuppressWarnings("ImmutableSetOf1")
final Object test = new PackageObjectFactory(Collections.singleton(null), classLoader,
TRY_IN_ALL_REGISTERED_PACKAGES);
assertWithMessage("Exception is expected but got " + test).fail();
--- a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java
@@ -84,6 +84,8 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
* @noinspectionreason ClassWithTooManyDependencies - complex tests require a
* large number of imports
*/
+// This class is referenced from another package.
+@SuppressWarnings("JUnitClassModifiers")
public class TreeWalkerTest extends AbstractModuleTestSupport {
@TempDir
--- a/src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilTest.java
@@ -47,6 +47,8 @@ import com.puppycrawl.tools.checkstyle.checks.coding.NestedIfDepthCheck;
import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck;
import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifierOption;
+// This class is referenced from another package.
+@SuppressWarnings("JUnitClassModifiers")
public class CheckUtilTest extends AbstractModuleTestSupport {
@Override