# Rule Bug: "@NonNull" values should not be set to null (java:S2637)

**URL:** <https://community.sonarsource.com/t/rule-bug-nonnull-values-should-not-be-set-to-null-java-s2637/58728>\
**Category:** SonarQube Cloud\
**Tags:** sonarqube-cloud, java\
**Created:** [February 21, 2022, 11:13pm UTC](https://community.sonarsource.com/t/rule-bug-nonnull-values-should-not-be-set-to-null-java-s2637/58728 "2022-02-21T23:13:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaburov](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/shaburov/32/30647_2.png) [@shaburov](https://community.sonarsource.com/u/shaburov)\
**Post date:** [February 21, 2022, 11:13pm UTC](https://community.sonarsource.com/t/rule-bug-nonnull-values-should-not-be-set-to-null-java-s2637/58728/1 "2022-02-21T23:13:46Z")

</div>

Rule: java:S2637  
**false-positive** happening

[Link to code](https://sonarcloud.io/project/issues?issues=AX8dg8mD_EUKEgaSx-dl&open=AX8dg8mD_EUKEgaSx-dl&id=touchbit_retrofit-veslo)

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/0/5/05265dc4f3256e236d85453413aa0ca899ce0ad1.png)

---

<div class="post-metadata">

**Author:** ![Dorian\_Burihabwa](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dorian_burihabwa/32/18750_2.png) [@Dorian\_Burihabwa](https://community.sonarsource.com/u/Dorian_Burihabwa)\
**Post date:** [March 16, 2022, 9:00pm UTC](https://community.sonarsource.com/t/rule-bug-nonnull-values-should-not-be-set-to-null-java-s2637/58728/6 "2022-03-16T21:00:19Z")

</div>

HI @shaburov,  
Thanks for reporting the issue. It looks like the analyzer is confused by the ternary expression and this is indeed a false positive.

A [ticket](https://jira.sonarsource.com/browse/SONARJAVA-4201) has been created to fix the problem.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [March 23, 2022, 9:00pm UTC](https://community.sonarsource.com/t/rule-bug-nonnull-values-should-not-be-set-to-null-java-s2637/58728/8 "2022-03-23T21:00:35Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
