[java] specify nullability in other java packages#17194
[java] specify nullability in other java packages#17194asolntsev wants to merge 3 commits intoSeleniumHQ:trunkfrom
Conversation
Partially implements SeleniumHQ#14291
Partially implements SeleniumHQ#14291
Partially implements SeleniumHQ#14291
Review Summary by QodoAdd JSpecify nullability annotations to events, interactions, and logging packages
WalkthroughsDescription• Add JSpecify @NullMarked annotations to events, interactions, and logging packages • Remove class-level @NullMarked annotations, replace with package-level declarations • Improve nullability handling in UnboundZmqEventBus by making sockets final and initializing in constructor • Update Encodable interface to use @Nullable Object in return types for better null-safety • Add @NullMarked method annotations to logging and remote driver implementations File Changes1. java/src/org/openqa/selenium/events/package-info.java
|
Code Review by Qodo
1. RejectedEvent may be null
|
| @SuppressWarnings("DataFlowIssue") | ||
| private static RejectedEvent fromJson(JsonInput input) { | ||
| EventName name = null; | ||
| Object data = null; |
There was a problem hiding this comment.
1. Rejectedevent may be null 🐞 Bug ✓ Correctness
ZeroMqEventBus.RejectedEvent.fromJson can construct a RejectedEvent with null name/data when the JSON omits those fields, but the class lives in an @NullMarked package so those fields/getters are treated as non-null. This can cause runtime NPEs in rejected-event handlers and can also trigger nullness-check failures in builds running NullAway.
Agent Prompt
## Issue description
`org.openqa.selenium.events.zeromq` is now `@NullMarked`, but `ZeroMqEventBus.RejectedEvent.fromJson` can still build a `RejectedEvent` with `null` `name`/`data` when the JSON payload is missing fields.
## Issue Context
Because the package is `@NullMarked`, `RejectedEvent.name`/`data` and their getters are implicitly non-null. Returning instances with nulls violates that contract and risks runtime NPEs.
## Fix Focus Areas
- java/src/org/openqa/selenium/events/zeromq/ZeroMqEventBus.java[140-173]
- java/src/org/openqa/selenium/events/zeromq/ZeroMqEventBus.java[175-181]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
🔗 Related Issues
Partially implements #14291
💥 What does this PR do?
Adds JSpecify nullability annotations to packages
org.openqa.selenium.docker.*🔄 Types of changes