[java:s2589] false positive with record

Please provide

  • Operating system: Mac OSX Tahoe 26.4.1
  • SonarQube for IntelliJ plugin version: 12.2.2.8462
  • IntelliJ version: IntelliJ IDEA 2025.3.4
  • Programming language you’re coding in: Java
  • Is connected mode used:
    • SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?): No

And a thorough description of the problem / question:

A record object has immutable fields.

And operation is an instance of SecurityBuySell that is a record

```

public record SecurityBuySell(
        BuySell type,
        @Nullable Amount brokerCommission,
...
```

It’s not possible that brokerCommission)= become null right after the first test.

Hi,

Could we have a reproducer snippet as code/text, rather than a screenshot?

 
Thx,
Ann