Fix warnings

- Fix some potential NPE cases.
- Fix warnings for missing @Nullable
This commit is contained in:
Janne Valkealahti
2022-11-19 15:08:49 +00:00
parent 83fb5f71fc
commit ee7a9da4aa
11 changed files with 48 additions and 28 deletions

View File

@@ -50,7 +50,9 @@ public class ShellOptionMethodArgumentResolver extends AbstractArgumentMethodArg
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
ShellOption annot = parameter.getParameterAnnotation(ShellOption.class);
Assert.state(annot != null, "No ShellOption annotation");
List<String> names = Arrays.stream(annot.value()).map(v -> StringUtils.trimLeadingCharacter(v, '-')).collect(Collectors.toList());
List<String> names = Arrays.stream(annot != null ? annot.value() : new String[0])
.map(v -> StringUtils.trimLeadingCharacter(v, '-'))
.collect(Collectors.toList());
return new HeaderNamedValueInfo(annot, names);
}