Skip to content

Commit afee543

Browse files
authored
Refactor determinePaths method and update generics
Remove unneeded logging from AbstractGenerateMojo and tweak generic signatures
1 parent 6e4eb38 commit afee543

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ private String protocVersion() {
12391239
: overriddenVersion;
12401240
}
12411241

1242-
private static Collection<Path> determinePaths(
1242+
private Collection<Path> determinePaths(
12431243
@Nullable Collection<Path> inputPaths,
12441244
Supplier<Collection<Path>> defaultIfMissing
12451245
) {
@@ -1254,21 +1254,15 @@ private static Collection<Path> determinePaths(
12541254
: transformed;
12551255

12561256
return finalValue.stream()
1257-
.filter(path -> {
1258-
if (Files.notExists(path)) {
1259-
log.info("Ignoring non-existent path \"{}\"", path);
1260-
return false;
1261-
}
1262-
return true;
1263-
})
1257+
.filter(Files::exists)
12641258
.collect(Collectors.toUnmodifiableList());
12651259
}
12661260

1267-
private static <T> List<T> nonNullList(@Nullable List<T> list) {
1261+
private <L> List<L> nonNullList(@Nullable List<L> list) {
12681262
return requireNonNullElseGet(list, List::of);
12691263
}
12701264

1271-
private static <K, V> Map<K, V> nonNullMap(@Nullable Map<K, V> map) {
1265+
private <K, V> Map<K, V> nonNullMap(@Nullable Map<K, V> map) {
12721266
return requireNonNullElseGet(map, Map::of);
12731267
}
12741268
}

0 commit comments

Comments
 (0)