This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 5a6c994d28ecc1e9f771535a616d2ec9ad6e51ae
Author: Lyor Goldstein <lgoldst...@apache.org>
AuthorDate: Mon Feb 15 18:58:30 2021 +0200

    [SSHD-1124] Using List<? extends ServiceFactory> method signature
---
 .../main/java/org/apache/sshd/client/session/ClientSessionImpl.java | 2 +-
 sshd-core/src/main/java/org/apache/sshd/common/FactoryManager.java  | 2 +-
 .../java/org/apache/sshd/common/helpers/AbstractFactoryManager.java | 6 +++---
 .../org/apache/sshd/client/ClientAuthenticationManagerTest.java     | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java 
b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
index 8367583..5d3c734 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
@@ -82,7 +82,7 @@ public class ClientSessionImpl extends AbstractClientSession {
         // Need to set the initial service early as calling code likes to 
start trying to
         // manipulate it before the connection has even been established. For 
instance, to
         // set the authPassword.
-        List<ServiceFactory> factories = client.getServiceFactories();
+        List<? extends ServiceFactory> factories = 
client.getServiceFactories();
         int numFactories = GenericUtils.size(factories);
         ValidateUtils.checkTrue((numFactories > 0) && (numFactories <= 2), 
"One or two services must be configured: %d",
                 numFactories);
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/FactoryManager.java 
b/sshd-core/src/main/java/org/apache/sshd/common/FactoryManager.java
index d229a41..e5abe88 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/FactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/FactoryManager.java
@@ -147,7 +147,7 @@ public interface FactoryManager
      *
      * @return a list of named <code>Service</code> factories, never {@code 
null}
      */
-    List<ServiceFactory> getServiceFactories();
+    List<? extends ServiceFactory> getServiceFactories();
 
     /**
      * Retrieve the list of global request handlers.
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
index 2a7758f..0d15a61 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
@@ -80,7 +80,7 @@ public abstract class AbstractFactoryManager extends 
AbstractKexFactoryManager i
     protected ForwarderFactory forwarderFactory;
     protected ForwardingFilter forwardingFilter;
     protected FileSystemFactory fileSystemFactory;
-    protected List<ServiceFactory> serviceFactories;
+    protected List<? extends ServiceFactory> serviceFactories;
     protected List<RequestHandler<ConnectionService>> globalRequestHandlers;
     protected SessionTimeoutListener sessionTimeoutListener;
     protected ScheduledFuture<?> timeoutListenerFuture;
@@ -276,11 +276,11 @@ public abstract class AbstractFactoryManager extends 
AbstractKexFactoryManager i
     }
 
     @Override
-    public List<ServiceFactory> getServiceFactories() {
+    public List<? extends ServiceFactory> getServiceFactories() {
         return serviceFactories;
     }
 
-    public void setServiceFactories(List<ServiceFactory> serviceFactories) {
+    public void setServiceFactories(List<? extends ServiceFactory> 
serviceFactories) {
         this.serviceFactories = serviceFactories;
     }
 
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
index 981f811..735b57f 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
@@ -299,7 +299,7 @@ public class ClientAuthenticationManagerTest extends 
BaseTestSupport {
         Factory<Random> randomFactory = new 
SingletonRandomFactory(JceRandomFactory.INSTANCE);
         Mockito.when(client.getRandomFactory()).thenReturn(randomFactory);
 
-        
Mockito.when(client.getServiceFactories()).thenReturn(SshClient.DEFAULT_SERVICE_FACTORIES);
+        Mockito.when(client.getServiceFactories()).thenReturn((List) 
SshClient.DEFAULT_SERVICE_FACTORIES);
         
Mockito.when(client.getUserAuthFactories()).thenReturn(SshClient.DEFAULT_USER_AUTH_FACTORIES);
         return createMockClientSession(client);
     }

Reply via email to