# Unexpected finding: java:S2638

**URL:** <https://community.sonarsource.com/t/unexpected-finding-java-s2638/190309>\
**Category:** Report False-positive / False-negative...\
**Tags:** false-positive, sonarqube, java\
**Created:** [October 20, 2026, 6:28am UTC](https://community.sonarsource.com/t/unexpected-finding-java-s2638/190309 "2026-10-20T06:28:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardWith](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@RichardWith](https://community.sonarsource.com/u/RichardWith)\
**Post date:** [October 20, 2026, 6:28am UTC](https://community.sonarsource.com/t/unexpected-finding-java-s2638/190309/1 "2026-10-20T06:28:32Z")

</div>

- Community Build v26.4.0.121862
- Language: Java 25
- Problem: java:S2638 occurs without any known reason

```java
package sampleS2638;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

@NonNullByDefault
interface Foo {
    interface Bar<T> {
        @Nullable
        T bar1();

        T bar2();
    }

    <T> T doBar(Bar<T> bar);
}

```

```java
package sampleS2638;

import org.eclipse.jdt.annotation.NonNull;

import java.util.Collection;
import java.util.Collections;

final class Sample {

    Collection<String> sample(@NonNull final Foo foo) {

        return foo.doBar(new Foo.Bar<Collection<String>>() {
            @NonNull
            @Override
            public Collection<String> bar1() {
                // ^^^^^^ java:S2638 "Fix the incompatibility of the annotation @Nullable to honor @NonNullByDefault at class level of the overridden method."
                return Collections.singleton(null);
            }

            @NonNull
            @Override
            public Collection<String> bar2() {
                return Collections.singleton(null);
            }
        });
    }
}

```

---

<div class="post-metadata">

**Author:** ![andres](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andres/32/76342_2.png) [@andres](https://community.sonarsource.com/u/andres)\
**Post date:** [October 21, 2026, 2:58pm UTC](https://community.sonarsource.com/t/unexpected-finding-java-s2638/190309/2 "2026-10-21T14:58:37Z")

</div>

Hey @RichardWith, welcome to the Community! This is [known issue](https://sonarsource.atlassian.net/browse/SONARJAVA-6714) that has already been fixed in newer SonarQube Community Build versions. I recommend that you update to a more modern version (the latest one is 26.10) and try again. If the issue persists, do let us know!
