[Task] Enable SpotBug checks disabled in 4.9.x upgrade and fix possible detected bugs
Search before asking
- [x] I searched in the issues and found nothing similar.
Motivation
In #24243 SpotBugs was upgraded from 4.7.3 to 4.9.3. Since new checks were introduced, the checks were disabled with the omitVisitors configuration to make the upgrade possible without addressing the issues in the upgrade PR.
Solution
As a follow up, it would be necessary to enable checks to see what the actual problems are and fix them one by one.
- [ ] ConstructorThrow
- [ ] FindPublicAttributes
- [ ] SharedVariableAtomicityDetector
- [ ] UnreadFields
- [ ] MultipleInstantiationsOfSingletons
- [ ] InitializeNonnullFieldsInConstructor
- [ ] FindNullDeref
Alternatives
The checks that are unnecessarily verbose for Pulsar's code style could be kept disabled so that we don't end up adding exclusions for each occurrence like we have done for EI_EXPOSE_REP/EI_EXPOSE_REP2 bug pattern.
For example, AT: This write of this 64-bit primitive variable may not atomic (AT_NONATOMIC_64BIT_PRIMITIVE) should be ignored in Pulsar source code since Pulsar required 64-bit JVM, #10311.
Anything else?
No response
Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
jbjkb