[spotbugs] Silence NP_BOOLEAN_RETURN_NULL in IgnoreNode#checkIgnored

Also mark the return value @Nullable to enable null analysis in Eclipse.

Change-Id: I5b286d657d432f4b32afd4dd370f76892b115422
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2020-12-04 11:01:06 +01:00
parent 5eabd6995a
commit 1fd0a49ce0
2 changed files with 10 additions and 1 deletions

View File

@ -77,6 +77,12 @@
<Bug pattern="NP_BOOLEAN_RETURN_NULL" /> <Bug pattern="NP_BOOLEAN_RETURN_NULL" />
</Match> </Match>
<Match>
<Class name="org.eclipse.jgit.ignore.IgnoreNode" />
<Method name="checkIgnored" />
<Bug pattern="NP_BOOLEAN_RETURN_NULL" />
</Match>
<!-- Transport initialization works like this --> <!-- Transport initialization works like this -->
<Match> <Match>
<Class name="org.eclipse.jgit.transport.Transport" /> <Class name="org.eclipse.jgit.transport.Transport" />

View File

@ -19,6 +19,8 @@
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.eclipse.jgit.annotations.Nullable;
/** /**
* Represents a bundle of ignore rules inherited from a base directory. * Represents a bundle of ignore rules inherited from a base directory.
* *
@ -135,7 +137,8 @@ public MatchResult isIgnored(String entryPath, boolean isDirectory) {
* undetermined * undetermined
* @since 4.11 * @since 4.11
*/ */
public Boolean checkIgnored(String entryPath, boolean isDirectory) { public @Nullable Boolean checkIgnored(String entryPath,
boolean isDirectory) {
// Parse rules in the reverse order that they were read because later // Parse rules in the reverse order that they were read because later
// rules have higher priority // rules have higher priority
for (int i = rules.size() - 1; i > -1; i--) { for (int i = rules.size() - 1; i > -1; i--) {