Skip to content

Commit 8642174

Browse files
Fix Sonar issue
1 parent 102e7a6 commit 8642174

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

jfiletreeprettyprinter-core/src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/options/PrettyPrintOptions.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Objects;
99
import java.util.function.Function;
1010
import java.util.function.ToIntFunction;
11+
import org.jspecify.annotations.NonNull;
1112
import org.jspecify.annotations.NullMarked;
1213
import org.jspecify.annotations.Nullable;
1314

@@ -213,11 +214,11 @@ public PrettyPrintOptions filterFiles(@Nullable PathMatcher matcher) {
213214
// ---------- Line extension ----------
214215

215216
@Nullable
216-
private Function<Path, String> lineExtension;
217+
private Function<@NonNull Path, @Nullable String> lineExtension;
217218

218219
@Override
219220
@Nullable
220-
public Function<Path, String> getLineExtension() {
221+
public Function<@NonNull Path, @Nullable String> getLineExtension() {
221222
return lineExtension;
222223
}
223224

@@ -237,7 +238,7 @@ public Function<Path, String> getLineExtension() {
237238
* @see LineExtensions
238239
* @see LineExtensionBuilder
239240
*/
240-
public PrettyPrintOptions withLineExtension(@Nullable Function<Path, String> lineExtension) {
241+
public PrettyPrintOptions withLineExtension(@Nullable Function<@NonNull Path, @Nullable String> lineExtension) {
241242
this.lineExtension = lineExtension;
242243
return this;
243244
}

jfiletreeprettyprinter-core/src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/renderer/DefaultLineRenderer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import java.util.List;
99
import java.util.Objects;
1010
import org.jspecify.annotations.NullMarked;
11-
import org.jspecify.annotations.Nullable;
1211

1312
@NullMarked
1413
class DefaultLineRenderer implements LineRenderer {
@@ -32,12 +31,12 @@ public String renderFile(Depth depth, FileEntry fileEntry) {
3231
}
3332

3433
@Override
35-
public @Nullable String renderChildLimitReached(Depth depth, SkippedChildrenEntry skippedChildrenEntry) {
34+
public String renderChildLimitReached(Depth depth, SkippedChildrenEntry skippedChildrenEntry) {
3635
return treeFormatter.format(depth) + fileFormatter.formatChildLimitReached(skippedChildrenEntry);
3736
}
3837

3938
@Override
40-
public @Nullable String renderMaxDepthReached(Depth depth, MaxDepthReachEntry maxDepthReachEntry) {
39+
public String renderMaxDepthReached(Depth depth, MaxDepthReachEntry maxDepthReachEntry) {
4140
return treeFormatter.format(depth) + fileFormatter.formatMaxDepthReached(maxDepthReachEntry);
4241
}
4342

jfiletreeprettyprinter-core/src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/renderer/RenderingOptions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.TreeFormat;
55
import java.nio.file.Path;
66
import java.util.function.Function;
7+
import org.jspecify.annotations.NonNull;
78
import org.jspecify.annotations.NullMarked;
89
import org.jspecify.annotations.Nullable;
910

@@ -33,6 +34,6 @@ public interface RenderingOptions {
3334
* @return
3435
*/
3536
@Nullable
36-
Function<Path, String> getLineExtension();
37+
Function<@NonNull Path, @Nullable String> getLineExtension();
3738

3839
}

0 commit comments

Comments
 (0)