Introduce ErrorProne, fix compiler warnings#4807
Introduce ErrorProne, fix compiler warnings#4807scordio wants to merge 2 commits intospring-projects:mainfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
8eb3acc to
8a6ddaf
Compare
|
This is fantastic! Thank you for doing that, @scordio ! I have a plan to re-work/optimise the project's build/release process for the next major release (see #4319 as well), and this goes in that same direction. When this is not a draft PR anymore, please let me know and it should be welcome to merge. |
f0efc64 to
459933c
Compare
6349088 to
48ae732
Compare
4f4dbfa to
ec33b20
Compare
scordio
left a comment
There was a problem hiding this comment.
Hi @fmbenhassine, I am finally ready with the changes!
I think there are a few flaky tests like:
SimpleStepFactoryBeanTests.testSimpleConcurrentJobJdbcPagingItemReaderCommonTests
I couldn't figure out the root cause, but the failing ones are green with single executions in the IDE or when retrying a complete Maven build... if you have any hints, please let me know!
| @SuppressWarnings("unused") | ||
| private static final String STAR_WILDCARD = "*"; | ||
|
|
||
| @SuppressWarnings("unused") | ||
| private static final String SQL_WILDCARD = "%"; |
There was a problem hiding this comment.
I suppressed the warnings here, but it might make sense to delete them instead.
| @SuppressWarnings("unused") // FIXME no usage - should it be deprecated for removal? | ||
| public class ConversionException extends RuntimeException { |
There was a problem hiding this comment.
As the comment mentions, ConversionException is currently unused in the codebase.
Should this be deprecated for removal?
There was a problem hiding this comment.
Yes, I will take care of that separately. Thank you for adding that "FIXME" for reference 👍
| -Xep:AlmostJavadoc:OFF | ||
| -Xep:BadInstanceof:OFF <!-- FIXME gh-4839 --> | ||
| -Xep:ByteBufferBackingArray:OFF | ||
| -Xep:ClassCanBeStatic:OFF | ||
| -Xep:CollectionUndefinedEquality:OFF | ||
| -Xep:DefaultCharset:OFF | ||
| -Xep:DirectInvocationOnMock:OFF | ||
| -Xep:DoNotCallSuggester:OFF | ||
| -Xep:EmptyCatch:OFF | ||
| -Xep:EqualsGetClass:OFF | ||
| -Xep:Finally:OFF | ||
| -Xep:FutureReturnValueIgnored:OFF | ||
| -Xep:HidingField:OFF | ||
| -Xep:ImmutableEnumChecker:OFF | ||
| -Xep:InlineMeSuggester:OFF | ||
| -Xep:InputStreamSlowMultibyteRead:OFF | ||
| -Xep:JavaTimeDefaultTimeZone:OFF | ||
| -Xep:JavaUtilDate:OFF | ||
| -Xep:JdkObsolete:OFF | ||
| -Xep:MissingSummary:OFF | ||
| -Xep:MixedMutabilityReturnType:OFF | ||
| -Xep:MutablePublicArray:OFF | ||
| -Xep:NonAtomicVolatileUpdate:OFF | ||
| -Xep:RedundantControlFlow:OFF | ||
| -Xep:ReferenceEquality:OFF | ||
| -Xep:StaticAssignmentInConstructor:OFF | ||
| -Xep:StaticAssignmentOfThrowable:OFF | ||
| -Xep:StaticMockMember:OFF | ||
| -Xep:StreamResourceLeak:OFF | ||
| -Xep:StringCaseLocaleUsage:OFF | ||
| -Xep:StringSplitter:OFF | ||
| -Xep:SynchronizeOnNonFinalField:OFF | ||
| -Xep:ThreadLocalUsage:OFF | ||
| -Xep:ThreadPriorityCheck:OFF | ||
| -Xep:TypeParameterUnusedInFormals:OFF | ||
| -Xep:UndefinedEquals:OFF | ||
| -Xep:UnnecessaryStringBuilder:OFF | ||
| -Xep:UnusedMethod:OFF | ||
| -Xep:UnusedVariable:OFF | ||
| -Xep:WaitNotInLoop:OFF |
There was a problem hiding this comment.
I excluded all the ErrorProne warnings that didn't have a straightforward solution.
I would suggest addressing them in separate PRs.
There was a problem hiding this comment.
Yes that's fine, we can address those in separate PRs.
e96e01d to
aaf4582
Compare
|
... and now the build is green! 😅 |
Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
|
Thanks! I'll continue with #4673 in the upcoming days 🙂 |
This PR introduces ErrorProne, sets the
maven-compiler-pluginto fail in case of compiler warnings, and fixes all the warnings.This is a preparation for: