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

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new 72d9542e [MRESOLVER-565] Class renames (#503)
72d9542e is described below

commit 72d9542e886d6ac2d6bf8b89da457202d8a260c9
Author: Tamas Cservenak <[email protected]>
AuthorDate: Thu Jun 13 13:27:10 2024 +0200

    [MRESOLVER-565] Class renames (#503)
    
    Rename classes to reflect what they are. These are "default 
implementations" used on new Session instances but usually not used in "real 
world".
    
    ---
    
    https://issues.apache.org/jira/browse/MRESOLVER-565
---
 .../aether/DefaultRepositorySystemSession.java     | 35 +++++++++++++++++-----
 .../impl/session/DefaultSessionBuilder.java        | 13 ++++----
 2 files changed, 34 insertions(+), 14 deletions(-)

diff --git 
a/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java
 
b/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java
index b9e4d470..ab7201ed 100644
--- 
a/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java
+++ 
b/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java
@@ -162,8 +162,8 @@ public final class DefaultRepositorySystemSession 
implements RepositorySystemSes
         configProperties = new HashMap<>();
         configPropertiesView = Collections.unmodifiableMap(configProperties);
         mirrorSelector = NullMirrorSelector.INSTANCE;
-        proxySelector = NullProxySelector.INSTANCE;
-        authenticationSelector = NullAuthenticationSelector.INSTANCE;
+        proxySelector = PassthroughProxySelector.INSTANCE;
+        authenticationSelector = PassthroughAuthenticationSelector.INSTANCE;
         artifactTypeRegistry = NullArtifactTypeRegistry.INSTANCE;
         data = new DefaultSessionData();
         this.onSessionEndedRegistrar = requireNonNull(onSessionEndedRegistrar, 
"onSessionEndedRegistrar");
@@ -633,7 +633,7 @@ public final class DefaultRepositorySystemSession 
implements RepositorySystemSes
         verifyStateForMutation();
         this.proxySelector = proxySelector;
         if (this.proxySelector == null) {
-            this.proxySelector = NullProxySelector.INSTANCE;
+            this.proxySelector = PassthroughProxySelector.INSTANCE;
         }
         return this;
     }
@@ -656,7 +656,7 @@ public final class DefaultRepositorySystemSession 
implements RepositorySystemSes
         verifyStateForMutation();
         this.authenticationSelector = authenticationSelector;
         if (this.authenticationSelector == null) {
-            this.authenticationSelector = NullAuthenticationSelector.INSTANCE;
+            this.authenticationSelector = 
PassthroughAuthenticationSelector.INSTANCE;
         }
         return this;
     }
@@ -862,40 +862,59 @@ public final class DefaultRepositorySystemSession 
implements RepositorySystemSes
         }
     }
 
-    static class NullProxySelector implements ProxySelector {
+    /**
+     * Simple "pass through" implementation of {@link ProxySelector} that 
simply returns what passed in
+     * {@link RemoteRepository} have set already, may return {@code null}.
+     */
+    static class PassthroughProxySelector implements ProxySelector {
 
-        public static final ProxySelector INSTANCE = new NullProxySelector();
+        public static final ProxySelector INSTANCE = new 
PassthroughProxySelector();
 
+        @Override
         public Proxy getProxy(RemoteRepository repository) {
             requireNonNull(repository, "repository cannot be null");
             return repository.getProxy();
         }
     }
 
+    /**
+     * Simple "null" implementation of {@link MirrorSelector} that returns 
{@code null} for any passed
+     * in {@link RemoteRepository}.
+     */
     static class NullMirrorSelector implements MirrorSelector {
 
         public static final MirrorSelector INSTANCE = new NullMirrorSelector();
 
+        @Override
         public RemoteRepository getMirror(RemoteRepository repository) {
             requireNonNull(repository, "repository cannot be null");
             return null;
         }
     }
 
-    static class NullAuthenticationSelector implements AuthenticationSelector {
+    /**
+     * Simple "pass through" implementation of {@link AuthenticationSelector} 
that simply returns what passed in
+     * {@link RemoteRepository} have set already, may return {@code null}.
+     */
+    static class PassthroughAuthenticationSelector implements 
AuthenticationSelector {
 
-        public static final AuthenticationSelector INSTANCE = new 
NullAuthenticationSelector();
+        public static final AuthenticationSelector INSTANCE = new 
PassthroughAuthenticationSelector();
 
+        @Override
         public Authentication getAuthentication(RemoteRepository repository) {
             requireNonNull(repository, "repository cannot be null");
             return repository.getAuthentication();
         }
     }
 
+    /**
+     * Simple "null" implementation of {@link ArtifactTypeRegistry} that 
returns {@code null} for any type ID.
+     */
     static final class NullArtifactTypeRegistry implements 
ArtifactTypeRegistry {
 
         public static final ArtifactTypeRegistry INSTANCE = new 
NullArtifactTypeRegistry();
 
+        @Override
         public ArtifactType get(String typeId) {
             return null;
         }
diff --git 
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/session/DefaultSessionBuilder.java
 
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/session/DefaultSessionBuilder.java
index d50dc0a4..02779b63 100644
--- 
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/session/DefaultSessionBuilder.java
+++ 
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/session/DefaultSessionBuilder.java
@@ -58,9 +58,10 @@ import static java.util.stream.Collectors.toList;
 public final class DefaultSessionBuilder implements SessionBuilder {
     private static final MirrorSelector NULL_MIRROR_SELECTOR = r -> null;
 
-    private static final ProxySelector NULL_PROXY_SELECTOR = 
RemoteRepository::getProxy;
+    private static final ProxySelector PASS_THROUGH_PROXY_SELECTOR = 
RemoteRepository::getProxy;
 
-    private static final AuthenticationSelector NULL_AUTHENTICATION_SELECTOR = 
RemoteRepository::getAuthentication;
+    private static final AuthenticationSelector 
PASS_THROUGH_AUTHENTICATION_SELECTOR =
+            RemoteRepository::getAuthentication;
 
     private static final ArtifactTypeRegistry NULL_ARTIFACT_TYPE_REGISTRY = t 
-> null;
 
@@ -106,9 +107,9 @@ public final class DefaultSessionBuilder implements 
SessionBuilder {
 
     private MirrorSelector mirrorSelector = NULL_MIRROR_SELECTOR;
 
-    private ProxySelector proxySelector = NULL_PROXY_SELECTOR;
+    private ProxySelector proxySelector = PASS_THROUGH_PROXY_SELECTOR;
 
-    private AuthenticationSelector authenticationSelector = 
NULL_AUTHENTICATION_SELECTOR;
+    private AuthenticationSelector authenticationSelector = 
PASS_THROUGH_AUTHENTICATION_SELECTOR;
 
     private ArtifactTypeRegistry artifactTypeRegistry = 
NULL_ARTIFACT_TYPE_REGISTRY;
 
@@ -282,7 +283,7 @@ public final class DefaultSessionBuilder implements 
SessionBuilder {
     public DefaultSessionBuilder setProxySelector(ProxySelector proxySelector) 
{
         this.proxySelector = proxySelector;
         if (this.proxySelector == null) {
-            this.proxySelector = NULL_PROXY_SELECTOR;
+            this.proxySelector = PASS_THROUGH_PROXY_SELECTOR;
         }
         return this;
     }
@@ -291,7 +292,7 @@ public final class DefaultSessionBuilder implements 
SessionBuilder {
     public DefaultSessionBuilder 
setAuthenticationSelector(AuthenticationSelector authenticationSelector) {
         this.authenticationSelector = authenticationSelector;
         if (this.authenticationSelector == null) {
-            this.authenticationSelector = NULL_AUTHENTICATION_SELECTOR;
+            this.authenticationSelector = PASS_THROUGH_AUTHENTICATION_SELECTOR;
         }
         return this;
     }

Reply via email to