Skip to content
Commits on Source (3)
language: java
sudo: false
dist: trusty
matrix:
include:
- os: linux
......@@ -10,18 +7,19 @@ matrix:
- os: linux
jdk: openjdk8
- os: linux
jdk: openjdk10
jdk: openjdk11
- os: linux
jdk: openjdk12
before_install:
# https://github.com/travis-ci/travis-ci/issues/8408
- unset _JAVA_OPTIONS
install: mvn clean dependency:go-offline -V
before_script: true
install: true
script:
- mvn verify
- mvn -V -Prun-its clean verify
cache:
directories:
......
......@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.3.1</version>
<version>1.4.0</version>
</parent>
<artifactId>maven-resolver-api</artifactId>
......
......@@ -30,7 +30,7 @@ public final class DefaultRepositoryCache
implements RepositoryCache
{
private final Map<Object, Object> cache = new ConcurrentHashMap<Object, Object>( 256 );
private final Map<Object, Object> cache = new ConcurrentHashMap<>( 256 );
public Object get( RepositorySystemSession session, Object key )
{
......
......@@ -127,11 +127,11 @@ public final class DefaultRepositorySystemSession
*/
public DefaultRepositorySystemSession()
{
systemProperties = new HashMap<String, String>();
systemProperties = new HashMap<>();
systemPropertiesView = Collections.unmodifiableMap( systemProperties );
userProperties = new HashMap<String, String>();
userProperties = new HashMap<>();
userPropertiesView = Collections.unmodifiableMap( userProperties );
configProperties = new HashMap<String, Object>();
configProperties = new HashMap<>();
configPropertiesView = Collections.unmodifiableMap( configProperties );
mirrorSelector = NullMirrorSelector.INSTANCE;
proxySelector = NullProxySelector.INSTANCE;
......@@ -212,7 +212,8 @@ public final class DefaultRepositorySystemSession
* descriptors, {@code false} to merge those with the originally specified repositories.
* @return This session for chaining, never {@code null}.
*/
public DefaultRepositorySystemSession setIgnoreArtifactDescriptorRepositories( boolean ignoreArtifactDescriptorRepositories )
public DefaultRepositorySystemSession setIgnoreArtifactDescriptorRepositories(
boolean ignoreArtifactDescriptorRepositories )
{
failIfReadOnly();
this.ignoreArtifactDescriptorRepositories = ignoreArtifactDescriptorRepositories;
......@@ -250,7 +251,8 @@ public final class DefaultRepositorySystemSession
* errors should generally not be tolerated.
* @return This session for chaining, never {@code null}.
*/
public DefaultRepositorySystemSession setArtifactDescriptorPolicy( ArtifactDescriptorPolicy artifactDescriptorPolicy )
public DefaultRepositorySystemSession setArtifactDescriptorPolicy(
ArtifactDescriptorPolicy artifactDescriptorPolicy )
{
failIfReadOnly();
this.artifactDescriptorPolicy = artifactDescriptorPolicy;
......@@ -398,16 +400,17 @@ public final class DefaultRepositorySystemSession
return this;
}
@SuppressWarnings( "checkstyle:magicnumber" )
private <T> Map<String, T> copySafe( Map<?, ?> table, Class<T> valueType )
{
Map<String, T> map;
if ( table == null || table.isEmpty() )
{
map = new HashMap<String, T>();
map = new HashMap<>();
}
else
{
map = new HashMap<String, T>( (int) ( table.size() / 0.75f ) + 1 );
map = new HashMap<>( (int) ( table.size() / 0.75f ) + 1 );
for ( Map.Entry<?, ?> entry : table.entrySet() )
{
Object key = entry.getKey();
......@@ -738,7 +741,8 @@ public final class DefaultRepositorySystemSession
* {@code null}.
* @return This session for chaining, never {@code null}.
*/
public DefaultRepositorySystemSession setDependencyGraphTransformer( DependencyGraphTransformer dependencyGraphTransformer )
public DefaultRepositorySystemSession setDependencyGraphTransformer(
DependencyGraphTransformer dependencyGraphTransformer )
{
failIfReadOnly();
this.dependencyGraphTransformer = dependencyGraphTransformer;
......
......@@ -35,7 +35,7 @@ public final class DefaultSessionData
public DefaultSessionData()
{
data = new ConcurrentHashMap<Object, Object>();
data = new ConcurrentHashMap<>();
}
public void set( Object key, Object value )
......
......@@ -49,6 +49,9 @@ public class RepositoryException
}
/**
* @param prefix The prefix.
* @param cause The exception that caused this one, may be {@code null}.
* @return The message.
* @noreference This method is not intended to be used by clients.
*/
protected static String getMessage( String prefix, Throwable cause )
......
......@@ -107,7 +107,8 @@ public interface RepositorySystem
* @see RepositorySystemSession#getArtifactDescriptorPolicy()
* @see #newResolutionRepositories(RepositorySystemSession, List)
*/
ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session, ArtifactDescriptorRequest request )
ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session,
ArtifactDescriptorRequest request )
throws ArtifactDescriptorException;
/**
......@@ -225,7 +226,8 @@ public interface RepositorySystem
* @throws IllegalArgumentException If the specified repository type is not recognized or no base directory is
* given.
*/
LocalRepositoryManager newLocalRepositoryManager( RepositorySystemSession session, LocalRepository localRepository );
LocalRepositoryManager newLocalRepositoryManager( RepositorySystemSession session,
LocalRepository localRepository );
/**
* Creates a new synchronization context.
......
......@@ -23,6 +23,7 @@ import java.io.File;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -115,7 +116,7 @@ public abstract class AbstractArtifact
public Artifact setFile( File file )
{
File current = getFile();
if ( ( current == null ) ? file == null : current.equals( file ) )
if ( Objects.equals( current, file ) )
{
return this;
}
......@@ -149,7 +150,7 @@ public abstract class AbstractArtifact
{
if ( properties != null && !properties.isEmpty() )
{
return Collections.unmodifiableMap( new HashMap<String, String>( properties ) );
return Collections.unmodifiableMap( new HashMap<>( properties ) );
}
else
{
......@@ -193,15 +194,13 @@ public abstract class AbstractArtifact
Artifact that = (Artifact) obj;
return getArtifactId().equals( that.getArtifactId() ) && getGroupId().equals( that.getGroupId() )
&& getVersion().equals( that.getVersion() ) && getExtension().equals( that.getExtension() )
&& getClassifier().equals( that.getClassifier() ) && eq( getFile(), that.getFile() )
&& getProperties().equals( that.getProperties() );
}
private static <T> boolean eq( T s1, T s2 )
{
return s1 != null ? s1.equals( s2 ) : s2 == null;
return Objects.equals( getArtifactId(), that.getArtifactId() )
&& Objects.equals( getGroupId(), that.getGroupId() )
&& Objects.equals( getVersion(), that.getVersion() )
&& Objects.equals( getExtension(), that.getExtension() )
&& Objects.equals( getClassifier(), that.getClassifier() )
&& Objects.equals( getFile(), that.getFile() )
&& Objects.equals( getProperties(), that.getProperties() );
}
/**
......
......@@ -56,6 +56,9 @@ public final class DefaultArtifact
*
* @param coords The artifact coordinates in the format
* {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>}, must not be {@code null}.
*
* @throws IllegalArgumentException If the artifact coordinates found in {@code coords} do not match the expected
* format.
*/
public DefaultArtifact( String coords )
{
......@@ -69,6 +72,9 @@ public final class DefaultArtifact
* @param coords The artifact coordinates in the format
* {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>}, must not be {@code null}.
* @param properties The artifact properties, may be {@code null}.
*
* @throws IllegalArgumentException If the artifact coordinates found in {@code coords} do not match the expected
* format.
*/
public DefaultArtifact( String coords, Map<String, String> properties )
{
......@@ -191,7 +197,7 @@ public final class DefaultArtifact
}
else
{
properties = new HashMap<String, String>();
properties = new HashMap<>();
if ( recessive != null )
{
properties.putAll( recessive );
......
......@@ -91,7 +91,7 @@ public final class DefaultArtifactType
}
this.extension = emptify( extension );
this.classifier = emptify( classifier );
Map<String, String> props = new HashMap<String, String>();
Map<String, String> props = new HashMap<>();
props.put( ArtifactProperties.TYPE, id );
props.put( ArtifactProperties.LANGUAGE, ( language != null && language.length() > 0 ) ? language : "none" );
props.put( ArtifactProperties.INCLUDES_DEPENDENCIES, Boolean.toString( includesDependencies ) );
......
......@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.graph.Dependency;
......@@ -37,7 +36,7 @@ import org.eclipse.aether.repository.RemoteRepository;
* retrieved from the artifact descriptor of the root dependency. And last, only direct dependencies can be specified in
* which case the root node of the resulting graph has no associated dependency.
*
* @see RepositorySystem#collectDependencies(RepositorySystemSession, CollectRequest)
* @see RepositorySystem#collectDependencies(org.eclipse.aether.RepositorySystemSession, CollectRequest)
*/
public final class CollectRequest
{
......@@ -199,7 +198,7 @@ public final class CollectRequest
{
if ( this.dependencies.isEmpty() )
{
this.dependencies = new ArrayList<Dependency>();
this.dependencies = new ArrayList<>();
}
this.dependencies.add( dependency );
}
......@@ -248,7 +247,7 @@ public final class CollectRequest
{
if ( this.managedDependencies.isEmpty() )
{
this.managedDependencies = new ArrayList<Dependency>();
this.managedDependencies = new ArrayList<>();
}
this.managedDependencies.add( managedDependency );
}
......@@ -296,7 +295,7 @@ public final class CollectRequest
{
if ( this.repositories.isEmpty() )
{
this.repositories = new ArrayList<RemoteRepository>();
this.repositories = new ArrayList<>();
}
this.repositories.add( repository );
}
......
......@@ -25,14 +25,13 @@ import java.util.List;
import static java.util.Objects.requireNonNull;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyCycle;
import org.eclipse.aether.graph.DependencyNode;
/**
* The result of a dependency collection request.
*
* @see RepositorySystem#collectDependencies(RepositorySystemSession, CollectRequest)
* @see RepositorySystem#collectDependencies(org.eclipse.aether.RepositorySystemSession, CollectRequest)
*/
public final class CollectResult
{
......@@ -89,7 +88,7 @@ public final class CollectResult
{
if ( exceptions.isEmpty() )
{
exceptions = new ArrayList<Exception>();
exceptions = new ArrayList<>();
}
exceptions.add( exception );
}
......@@ -118,7 +117,7 @@ public final class CollectResult
{
if ( cycles.isEmpty() )
{
cycles = new ArrayList<DependencyCycle>();
cycles = new ArrayList<>();
}
cycles.add( cycle );
}
......
......@@ -22,13 +22,12 @@ package org.eclipse.aether.collection;
import java.util.Collection;
import java.util.Map;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.Exclusion;
/**
* The management updates to apply to a dependency.
*
* @see DependencyManager#manageDependency(Dependency)
* @see DependencyManager#manageDependency(org.eclipse.aether.graph.Dependency)
*/
public final class DependencyManagement
{
......
......@@ -57,7 +57,7 @@ public class UnsolvableVersionConflictException
else
{
this.paths = paths;
this.versions = new LinkedHashSet<String>();
this.versions = new LinkedHashSet<>();
for ( List<? extends DependencyNode> path : paths )
{
VersionConstraint constraint = path.get( path.size() - 1 ).getVersionConstraint();
......@@ -75,7 +75,7 @@ public class UnsolvableVersionConflictException
if ( paths != null )
{
Collection<String> strings = new LinkedHashSet<String>();
Collection<String> strings = new LinkedHashSet<>();
for ( List<? extends DependencyNode> path : paths )
{
......
......@@ -23,8 +23,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.metadata.Metadata;
......@@ -33,7 +31,7 @@ import org.eclipse.aether.repository.RemoteRepository;
/**
* A request to deploy artifacts and their accompanying metadata into the a remote repository.
*
* @see RepositorySystem#deploy(RepositorySystemSession, DeployRequest)
* @see org.eclipse.aether.RepositorySystem#deploy(org.eclipse.aether.RepositorySystemSession, DeployRequest)
*/
public final class DeployRequest
{
......@@ -94,7 +92,7 @@ public final class DeployRequest
{
if ( artifacts.isEmpty() )
{
artifacts = new ArrayList<Artifact>();
artifacts = new ArrayList<>();
}
artifacts.add( artifact );
}
......@@ -142,7 +140,7 @@ public final class DeployRequest
{
if ( this.metadata.isEmpty() )
{
this.metadata = new ArrayList<Metadata>();
this.metadata = new ArrayList<>();
}
this.metadata.add( metadata );
}
......
......@@ -25,14 +25,13 @@ import java.util.Collections;
import static java.util.Objects.requireNonNull;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.metadata.Metadata;
/**
* The result of deploying artifacts and their accompanying metadata into the a remote repository.
*
* @see RepositorySystem#deploy(RepositorySystemSession, DeployRequest)
* @see RepositorySystem#deploy(org.eclipse.aether.RepositorySystemSession, DeployRequest)
*/
public final class DeployResult
{
......@@ -106,7 +105,7 @@ public final class DeployResult
{
if ( artifacts.isEmpty() )
{
artifacts = new ArrayList<Artifact>();
artifacts = new ArrayList<>();
}
artifacts.add( artifact );
}
......@@ -155,7 +154,7 @@ public final class DeployResult
{
if ( this.metadata.isEmpty() )
{
this.metadata = new ArrayList<Metadata>();
this.metadata = new ArrayList<>();
}
this.metadata.add( metadata );
}
......
......@@ -71,7 +71,8 @@ public final class DefaultDependencyNode
this.dependency = dependency;
artifact = ( dependency != null ) ? dependency.getArtifact() : null;
children = new ArrayList<DependencyNode>( 0 );
aliases = relocations = Collections.emptyList();
aliases = Collections.emptyList();
relocations = Collections.emptyList();
repositories = Collections.emptyList();
context = "";
data = Collections.emptyMap();
......@@ -88,7 +89,8 @@ public final class DefaultDependencyNode
{
this.artifact = artifact;
children = new ArrayList<DependencyNode>( 0 );
aliases = relocations = Collections.emptyList();
aliases = Collections.emptyList();
relocations = Collections.emptyList();
repositories = Collections.emptyList();
context = "";
data = Collections.emptyMap();
......@@ -104,7 +106,7 @@ public final class DefaultDependencyNode
{
dependency = node.getDependency();
artifact = node.getArtifact();
children = new ArrayList<DependencyNode>( 0 );
children = new ArrayList<>( 0 );
setAliases( node.getAliases() );
setRequestContext( node.getRequestContext() );
setManagedBits( node.getManagedBits() );
......@@ -113,7 +115,7 @@ public final class DefaultDependencyNode
setVersion( node.getVersion() );
setVersionConstraint( node.getVersionConstraint() );
Map<?, ?> data = node.getData();
setData( data.isEmpty() ? null : new HashMap<Object, Object>( data ) );
setData( data.isEmpty() ? null : new HashMap<>( data ) );
}
public List<DependencyNode> getChildren()
......@@ -125,7 +127,7 @@ public final class DefaultDependencyNode
{
if ( children == null )
{
this.children = new ArrayList<DependencyNode>( 0 );
this.children = new ArrayList<>( 0 );
}
else
{
......@@ -330,7 +332,7 @@ public final class DefaultDependencyNode
{
if ( data.isEmpty() )
{
data = new HashMap<Object, Object>( 1, 2 ); // nodes can be numerous so let's be space conservative
data = new HashMap<>( 1, 2 ); // nodes can be numerous so let's be space conservative
}
data.put( key, value );
}
......
......@@ -26,6 +26,8 @@ import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.NoSuchElementException;
import static java.util.Objects.requireNonNull;
import java.util.Objects;
import java.util.Set;
import org.eclipse.aether.artifact.Artifact;
......@@ -170,7 +172,7 @@ public final class Dependency
*/
public Dependency setOptional( Boolean optional )
{
if ( eq( this.optional, optional ) )
if ( Objects.equals( this.optional, optional ) )
{
return this;
}
......@@ -220,7 +222,7 @@ public final class Dependency
@Override
public String toString()
{
return String.valueOf( getArtifact() ) + " (" + getScope() + ( isOptional() ? "?" : "" ) + ")";
return getArtifact() + " (" + getScope() + ( isOptional() ? "?" : "" ) + ")";
}
@Override
......@@ -237,13 +239,8 @@ public final class Dependency
Dependency that = (Dependency) obj;
return artifact.equals( that.artifact ) && scope.equals( that.scope ) && eq( optional, that.optional )
&& exclusions.equals( that.exclusions );
}
private static <T> boolean eq( T o1, T o2 )
{
return ( o1 != null ) ? o1.equals( o2 ) : o2 == null;
return Objects.equals( artifact, that.artifact ) && Objects.equals( scope, that.scope )
&& Objects.equals( optional, that.optional ) && Objects.equals( exclusions, that.exclusions );
}
@Override
......@@ -276,7 +273,7 @@ public final class Dependency
{
if ( exclusions.size() > 1 && !( exclusions instanceof Set ) )
{
exclusions = new LinkedHashSet<Exclusion>( exclusions );
exclusions = new LinkedHashSet<>( exclusions );
}
this.exclusions = exclusions.toArray( new Exclusion[exclusions.size()] );
}
......
......@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.Collections;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.metadata.Metadata;
......@@ -91,7 +90,7 @@ public final class InstallRequest
{
if ( artifacts.isEmpty() )
{
artifacts = new ArrayList<Artifact>();
artifacts = new ArrayList<>();
}
artifacts.add( artifact );
}
......@@ -139,7 +138,7 @@ public final class InstallRequest
{
if ( this.metadata.isEmpty() )
{
this.metadata = new ArrayList<Metadata>();
this.metadata = new ArrayList<>();
}
this.metadata.add( metadata );
}
......
......@@ -24,15 +24,13 @@ import java.util.Collection;
import java.util.Collections;
import static java.util.Objects.requireNonNull;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.metadata.Metadata;
/**
* The result of installing artifacts and their accompanying metadata into the a remote repository.
*
* @see RepositorySystem#install(RepositorySystemSession, InstallRequest)
* @see org.eclipse.aether.RepositorySystem#install(org.eclipse.aether.RepositorySystemSession, InstallRequest)
*/
public final class InstallResult
{
......@@ -106,7 +104,7 @@ public final class InstallResult
{
if ( artifacts.isEmpty() )
{
artifacts = new ArrayList<Artifact>();
artifacts = new ArrayList<>();
}
artifacts.add( artifact );
}
......@@ -155,7 +153,7 @@ public final class InstallResult
{
if ( this.metadata.isEmpty() )
{
this.metadata = new ArrayList<Metadata>();
this.metadata = new ArrayList<>();
}
this.metadata.add( metadata );
}
......