|
59 | 59 | <properties> |
60 | 60 | <java.version>17</java.version> |
61 | 61 | <!-- release, not source/target: compiles against the Java 17 API even when the build |
62 | | - runs on a newer JDK (the NullAway profile below runs only on JDK 21+). --> |
| 62 | + runs on a newer JDK (the errorprone profile below runs only on JDK 21+). --> |
63 | 63 | <maven.compiler.release>${java.version}</maven.compiler.release> |
64 | 64 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
65 | 65 | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
|
94 | 94 | <owasp.version>13.0.0</owasp.version> |
95 | 95 | <cyclonedx-maven-plugin.version>2.9.3</cyclonedx-maven-plugin.version> |
96 | 96 |
|
97 | | - <!-- Null checking (nullaway profile, JDK 21+ only) --> |
| 97 | + <!-- Error Prone and NullAway (errorprone profile, JDK 21+ only) --> |
98 | 98 | <errorprone.version>2.50.0</errorprone.version> |
99 | 99 | <nullaway.version>0.13.8</nullaway.version> |
100 | 100 | </properties> |
|
157 | 157 | </dependency> |
158 | 158 |
|
159 | 159 | <!-- Null-marking annotations (@NullMarked, @Nullable). Annotations only; NullAway |
160 | | - enforces them in the nullaway profile. --> |
| 160 | + enforces them in the errorprone profile. --> |
161 | 161 | <dependency> |
162 | 162 | <groupId>org.jspecify</groupId> |
163 | 163 | <artifactId>jspecify</artifactId> |
|
369 | 369 | </build> |
370 | 370 |
|
371 | 371 | <profiles> |
372 | | - <!-- NullAway: enforces the JSpecify null-marking of main sources at ERROR. |
| 372 | + <!-- Error Prone: Error Prone's own bug checks and NullAway, at ERROR, on main sources. |
373 | 373 | Error Prone 2.50 runs only on JDK 21+, while the SDK targets Java 17 and its |
374 | | - release build runs on JDK 17, so the check activates by JDK: every build on |
| 374 | + release build runs on JDK 17, so the profile activates by JDK: every build on |
375 | 375 | JDK 21+ (including the CI job that exists for it) is checked, and a JDK 17 |
376 | 376 | build compiles exactly as before. The javac internals Error Prone needs are |
377 | | - opened in .mvn/jvm.config. Scope, per the canonical Java library guide: |
378 | | - - only NullAway, every other Error Prone check disabled (nullness, not lint); |
379 | | - - only @NullMarked packages (OnlyNullMarked), in JSpecify mode; |
| 377 | + opened in .mvn/jvm.config. Scope: |
| 378 | + - Error Prone's default-enabled checks, and failOnWarning (javac -Werror), so a |
| 379 | + check whose default severity is WARNING fails the build like an ERROR one. |
| 380 | + -Werror also fails on javac's own default warnings (removal, for one), which |
| 381 | + are worth failing on too; suggestions stay notes. A new Error Prone version |
| 382 | + brings its new checks in at ERROR: triage them on upgrade. |
| 383 | + - Checks that are pure style for this code base are disabled by name below, |
| 384 | + each with its reason. A real exception is a @SuppressWarnings with a reason. |
| 385 | + - Beyond the defaults, two bug finders that fit this code base: |
| 386 | + CheckReturnValue over reactor.core.publisher: a Mono or Flux operator whose |
| 387 | + result is dropped never runs. Results that are fine to drop (subscribe's |
| 388 | + Disposable, a terminal tryEmit*, fluent sink callbacks) are listed with |
| 389 | + reasons in config/errorprone/reactor-ignorable-results.txt. |
| 390 | + SystemOut: the stdio transport owns System.out, and anything else printed |
| 391 | + there corrupts the JSON-RPC stream. |
| 392 | + - NullAway: only @NullMarked packages (OnlyNullMarked), in JSpecify mode. |
380 | 393 | - only default-compile: test sources are deliberately unchecked; |
381 | 394 | - never fork the compiler (compiler-plugin then hides every diagnostic). --> |
382 | 395 | <profile> |
383 | | - <id>nullaway</id> |
| 396 | + <id>errorprone</id> |
384 | 397 | <activation> |
385 | 398 | <jdk>[21,)</jdk> |
386 | 399 | </activation> |
|
393 | 406 | <execution> |
394 | 407 | <id>default-compile</id> |
395 | 408 | <configuration> |
| 409 | + <failOnWarning>true</failOnWarning> |
396 | 410 | <compilerArgs> |
397 | 411 | <arg>-XDcompilePolicy=simple</arg> |
398 | 412 | <arg>--should-stop=ifError=FLOW</arg> |
399 | 413 | <arg>-XDaddTypeAnnotationsToSymbol=true</arg> |
400 | | - <arg>-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:JSpecifyMode=true -XepOpt:NullAway:OnlyNullMarked=true</arg> |
| 414 | + <!-- Disabled, as style for this code base: |
| 415 | + StatementSwitchToExpressionSwitch: arrow or colon switch is a style choice. --> |
| 416 | + <arg>-Xplugin:ErrorProne -Xep:StatementSwitchToExpressionSwitch:OFF -Xep:SystemOut:ERROR -XepOpt:CheckReturnValue:Packages=reactor.core.publisher -XepOpt:CheckReturnValue:ApiExclusionList=${maven.multiModuleProjectDirectory}/config/errorprone/reactor-ignorable-results.txt -Xep:NullAway:ERROR -XepOpt:NullAway:JSpecifyMode=true -XepOpt:NullAway:OnlyNullMarked=true</arg> |
401 | 417 | </compilerArgs> |
402 | 418 | <annotationProcessorPaths> |
403 | 419 | <path> |
|
0 commit comments