merlimat opened a new pull request, #25446:
URL: https://github.com/apache/pulsar/pull/25446
## Summary
- Enable `-Xlint:deprecation` and `-Xlint:unchecked` compiler flags in
`pulsar.java-conventions.gradle.kts`
- Fix all ~450+ compilation warnings across 152 files, bringing the count
down to 3 unfixable varargs heap pollution warnings on interface methods
- Suppress `-Xlint:-dep-ann` for LightProto generated code in
`pulsar-functions-proto`
### Categories of fixes:
- Replace deprecated Commons Lang3 APIs (`MutableObject.getValue()` →
`.get()`, `MutableLong.getValue()` → `.longValue()`,
`StringUtils.equals(CharSequence)` → `Objects.equals()`,
`StringUtils.containsIgnoreCase` → lowercase comparison)
- Replace deprecated Guava `Charsets.UTF_8` → `StandardCharsets.UTF_8`
- Replace deprecated `Class.newInstance()` →
`getDeclaredConstructor().newInstance()`
- Add `@SuppressWarnings("deprecation")` where deprecated APIs are
intentionally used (JJWT, Swagger `@Api`, deprecated interface implementations)
- Add `@SuppressWarnings("unchecked")` for raw type casts
- Fix raw `CompletableFuture()` → `CompletableFuture<>()`
- Remove duplicate `@Getter` annotations on manually-defined getters
### Remaining unfixable warnings (3):
- `ProducerBuilder.intercept(ProducerInterceptor<T>...)` — varargs heap
pollution
- `ConsumerBuilder.intercept(ConsumerInterceptor<T>...)` — varargs heap
pollution
- `ReaderBuilder.intercept(ReaderInterceptor<T>...)` — varargs heap pollution
These are interface methods where `@SafeVarargs` cannot be applied (Java
language limitation).
## Test plan
- [x] `./gradlew compileJava --rerun-tasks` passes with only 3 unfixable
warnings
- [ ] CI passes
## Documentation
- [x] `doc-not-needed`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]