gnodet commented on code in PR #13011:
URL: https://github.com/apache/maven/pull/13011#discussion_r3913825868
##########
impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/SessionStub.java:
##########
@@ -203,6 +204,17 @@ public Collection<Listener> getListeners() {
return null;
}
+ @Override
+ public void registerListener(RepositoryListener listener) {}
+
+ @Override
+ public void unregisterListener(RepositoryListener listener) {}
+
+ @Override
+ public Collection<RepositoryListener> getRepositoryListeners() {
+ return null;
Review Comment:
**Low:** `getRepositoryListeners()` returns `null`, but the `Session`
interface (added in this same PR) declares it `@Nonnull` with Javadoc "never
`null`". The real implementation in `AbstractSession` correctly returns an
unmodifiable collection.
Consider returning `List.of()` or `Collections.emptyList()` here to honor
the contract:
```suggestion
return List.of();
```
(The pre-existing `getListeners()` above has the same `null`-return
anti-pattern, but no need to extend it to new methods.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]