# FP S2637 with @NonNullApi in package-info.java

**URL:** <https://community.sonarsource.com/t/fp-s2637-with-nonnullapi-in-package-info-java/107259>\
**Category:** Report False-positive / False-negative...\
**Tags:** false-positive, sonarqube, java\
**Created:** [January 12, 2024, 10:56am UTC](https://community.sonarsource.com/t/fp-s2637-with-nonnullapi-in-package-info-java/107259 "2024-01-12T10:56:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fjakop](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fjakop/32/27085_2.png) [@fjakop](https://community.sonarsource.com/u/fjakop)\
**Post date:** [January 12, 2024, 10:56am UTC](https://community.sonarsource.com/t/fp-s2637-with-nonnullapi-in-package-info-java/107259/1 "2024-01-12T10:56:02Z")

</div>

- SonarQube Developer Edition Version 10.2 (build 77647)
- org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594:sonar

We’re forcing all api to be non-null by `package-info.java` containing

```auto
    @NonNullApi
    @NonNullFields
    package mypackage;

    import org.springframework.lang.NonNullApi;
    import org.springframework.lang.NonNullFields;

```

This is overrideable by specific method annotations, consider a class `MyService `

```auto
    package mypackage;

    import jakarta.annotation.Nullable;

    public class MyService {
        static class InnerService {
          @Nullable
          public String getValue() {
              return null;
          }
        }
    }

```

SonarQube raises S2637 at `return null;` which we consider a false positive.

Can anyone confirm this?

---

<div class="post-metadata">

**Author:** ![angelo.buono](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/angelo.buono/32/44736_2.png) [@angelo.buono](https://community.sonarsource.com/u/angelo.buono)\
**Post date:** [January 22, 2024, 9:39am UTC](https://community.sonarsource.com/t/fp-s2637-with-nonnullapi-in-package-info-java/107259/4 "2024-01-22T09:39:47Z")

</div>

Hello @fjakop,

In my case, I failed to reproduce the scenario with your example: no issue is reported on the `return null` statement. Could you please provide a reproducer so I can investigate it more accurately?

Unfortunately, rule S2637 relies on the Symbolic Execution engine that is not currently maintained, and it may even be decommissioned in favor of a better engine. This rule happens to be very noisy; you can find [here](https://sonarsource.atlassian.net/browse/SONARJAVA-4201?jql=issuetype%20%3D%20False-Positive%20AND%20status%20%3D%20Open%20AND%20text%20~%20%22S2637*%22) a list of FP reported so far.  
My suggestion is to ignore the issue raised. If you provide a reproducer, I will check it and add it to the list of known False Positives.

Cheers,  
Angelo

---

<div class="post-metadata">

**Author:** ![fjakop](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fjakop/32/27085_2.png) [@fjakop](https://community.sonarsource.com/u/fjakop)\
**Post date:** [December 20, 2024, 7:26am UTC](https://community.sonarsource.com/t/fp-s2637-with-nonnullapi-in-package-info-java/107259/6 "2024-12-20T07:26:30Z")

</div>

Hello Angelo,  
I can confirm this is gone with version v10.7 of SonarQube.  
Thanks a lot.
