diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java index a602f9f83ee..a965c9012f6 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java @@ -18,6 +18,8 @@ */ package org.apache.maven.api.services; +import java.util.Objects; + import org.apache.maven.api.ArtifactCoordinates; import org.apache.maven.api.Session; import org.apache.maven.api.annotations.Experimental; @@ -25,8 +27,6 @@ import org.apache.maven.api.annotations.Nonnull; import org.apache.maven.api.annotations.NotThreadSafe; -import java.util.Objects; - /** * A request for creating a {@link ArtifactCoordinates} object. * @@ -57,7 +57,7 @@ public interface ArtifactCoordinatesFactoryRequest { static ArtifactCoordinatesFactoryRequest build( @Nonnull Session session, String groupId, String artifactId, String version, String extension) { return ArtifactCoordinatesFactoryRequest.builder() - .session( Objects.requireNonNull( session, "session" ) ) + .session(Objects.requireNonNull(session, "session")) .groupId(groupId) .artifactId(artifactId) .version(version) @@ -75,7 +75,7 @@ static ArtifactCoordinatesFactoryRequest build( String extension, String type) { return ArtifactCoordinatesFactoryRequest.builder() - .session( Objects.requireNonNull( session, "session" ) ) + .session(Objects.requireNonNull(session, "session")) .groupId(groupId) .artifactId(artifactId) .version(version) @@ -88,16 +88,16 @@ static ArtifactCoordinatesFactoryRequest build( @Nonnull static ArtifactCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnull String coordinateString) { return ArtifactCoordinatesFactoryRequest.builder() - .session( Objects.requireNonNull( session, "session" ) ) - .coordinateString( Objects.requireNonNull( coordinateString, "coordinateString" ) ) + .session(Objects.requireNonNull(session, "session")) + .coordinateString(Objects.requireNonNull(coordinateString, "coordinateString")) .build(); } @Nonnull static ArtifactCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnull ArtifactCoordinates coordinates) { return ArtifactCoordinatesFactoryRequest.builder() - .session( Objects.requireNonNull( session, "session" ) ) - .groupId( Objects.requireNonNull( coordinates, "coordinates" ).getGroupId()) + .session(Objects.requireNonNull(session, "session")) + .groupId(Objects.requireNonNull(coordinates, "coordinates").getGroupId()) .artifactId(coordinates.getArtifactId()) .classifier(coordinates.getClassifier()) .version(coordinates.getVersionConstraint().asString()) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java index f9cf594e960..cb53e21802a 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java @@ -59,9 +59,9 @@ static ArtifactDeployerRequest build( @Nonnull RemoteRepository repository, @Nonnull Collection artifacts) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .repository( Objects.requireNonNull( repository, "repository cannot be null" ) ) - .artifacts( Objects.requireNonNull( artifacts, "artifacts cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .repository(Objects.requireNonNull(repository, "repository cannot be null")) + .artifacts(Objects.requireNonNull(artifacts, "artifacts cannot be null")) .build(); } @@ -113,8 +113,8 @@ private static class DefaultArtifactDeployerRequest extends BaseRequest @Nonnull Collection artifacts, int retryFailedDeploymentCount) { super(session); - this.repository = Objects.requireNonNull( repository, "repository cannot be null" ); - this.artifacts = unmodifiable( Objects.requireNonNull( artifacts, "artifacts cannot be null" ) ); + this.repository = Objects.requireNonNull(repository, "repository cannot be null"); + this.artifacts = unmodifiable(Objects.requireNonNull(artifacts, "artifacts cannot be null")); this.retryFailedDeploymentCount = retryFailedDeploymentCount; } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java index e2b2b2f937d..4a2078fc215 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java @@ -18,14 +18,14 @@ */ package org.apache.maven.api.services; +import java.util.Objects; + import org.apache.maven.api.Session; import org.apache.maven.api.annotations.Experimental; import org.apache.maven.api.annotations.Immutable; import org.apache.maven.api.annotations.Nonnull; import org.apache.maven.api.annotations.NotThreadSafe; -import java.util.Objects; - /** * * @@ -53,7 +53,7 @@ public interface ArtifactFactoryRequest { static ArtifactFactoryRequest build( Session session, String groupId, String artifactId, String version, String extension) { return ArtifactFactoryRequest.builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .groupId(groupId) .artifactId(artifactId) .version(version) @@ -70,7 +70,7 @@ static ArtifactFactoryRequest build( String extension, String type) { return ArtifactFactoryRequest.builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .groupId(groupId) .artifactId(artifactId) .version(version) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java index 53d2873cd43..07d2e6dc709 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java @@ -53,8 +53,8 @@ static ArtifactInstallerRequestBuilder builder() { @Nonnull static ArtifactInstallerRequest build(Session session, Collection artifacts) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .artifacts( Objects.requireNonNull( artifacts, "artifacts cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .artifacts(Objects.requireNonNull(artifacts, "artifacts cannot be null")) .build(); } @@ -88,7 +88,7 @@ static class DefaultArtifactInstallerRequest extends BaseRequest implem DefaultArtifactInstallerRequest(@Nonnull Session session, @Nonnull Collection artifacts) { super(session); - this.artifacts = unmodifiable( Objects.requireNonNull( artifacts, "artifacts cannot be null" ) ); + this.artifacts = unmodifiable(Objects.requireNonNull(artifacts, "artifacts cannot be null")); } @Nonnull diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java index 9580c933195..e40a9e765ed 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java @@ -57,8 +57,8 @@ static ArtifactResolverRequestBuilder builder() { static ArtifactResolverRequest build( @Nonnull Session session, @Nonnull Collection coordinates) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .coordinates( Objects.requireNonNull( coordinates, "coordinates cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .coordinates(Objects.requireNonNull(coordinates, "coordinates cannot be null")) .build(); } @@ -68,8 +68,8 @@ static ArtifactResolverRequest build( @Nonnull Collection coordinates, List repositories) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .coordinates( Objects.requireNonNull( coordinates, "coordinates cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .coordinates(Objects.requireNonNull(coordinates, "coordinates cannot be null")) .repositories(repositories) .build(); } @@ -118,7 +118,7 @@ private static class DefaultArtifactResolverRequest extends BaseRequest @Nonnull Collection coordinates, @Nonnull List repositories) { super(session); - this.coordinates = unmodifiable( Objects.requireNonNull( coordinates, "coordinates cannot be null" ) ); + this.coordinates = unmodifiable(Objects.requireNonNull(coordinates, "coordinates cannot be null")); this.repositories = repositories; } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BaseRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BaseRequest.java index 1a6b7c111c6..ab5534917e5 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BaseRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BaseRequest.java @@ -38,7 +38,7 @@ abstract class BaseRequest { private final S session; protected BaseRequest(@Nonnull S session) { - this.session = Objects.requireNonNull( session, "session cannot be null" ); + this.session = Objects.requireNonNull(session, "session cannot be null"); } @Nonnull diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java index ecd8e765dbc..fee1f942761 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java @@ -57,7 +57,7 @@ static DependencyCoordinatesFactoryRequest build( String extension, String type) { return DependencyCoordinatesFactoryRequest.builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .groupId(groupId) .artifactId(artifactId) .version(version) @@ -71,8 +71,9 @@ static DependencyCoordinatesFactoryRequest build( static DependencyCoordinatesFactoryRequest build( @Nonnull Session session, @Nonnull ArtifactCoordinates coordinates) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .groupId( Objects.requireNonNull( coordinates, "coordinates cannot be null" ).getGroupId()) + .session(Objects.requireNonNull(session, "session cannot be null")) + .groupId(Objects.requireNonNull(coordinates, "coordinates cannot be null") + .getGroupId()) .artifactId(coordinates.getArtifactId()) .version(coordinates.getVersionConstraint().asString()) .classifier(coordinates.getClassifier()) @@ -83,8 +84,8 @@ static DependencyCoordinatesFactoryRequest build( @Nonnull static DependencyCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnull Dependency dependency) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .groupId( Objects.requireNonNull( dependency, "dependency" ).getGroupId()) + .session(Objects.requireNonNull(session, "session cannot be null")) + .groupId(Objects.requireNonNull(dependency, "dependency").getGroupId()) .artifactId(dependency.getArtifactId()) .version(dependency.getVersion().asString()) .classifier(dependency.getClassifier()) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyResolverRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyResolverRequest.java index f79b76cba16..79280e914de 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyResolverRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyResolverRequest.java @@ -395,17 +395,15 @@ static class DefaultDependencyResolverRequest extends BaseRequest @Nullable Predicate pathTypeFilter, @Nullable List repositories) { super(session); - this.requestType = Objects.requireNonNull( requestType, "requestType cannot be null" ); + this.requestType = Objects.requireNonNull(requestType, "requestType cannot be null"); this.project = project; this.rootArtifact = rootArtifact; this.root = root; - this.dependencies = unmodifiable( - Objects.requireNonNull( dependencies, "dependencies cannot be null" ) ); + this.dependencies = unmodifiable(Objects.requireNonNull(dependencies, "dependencies cannot be null")); this.managedDependencies = - unmodifiable( - Objects.requireNonNull( managedDependencies, "managedDependencies cannot be null" ) ); + unmodifiable(Objects.requireNonNull(managedDependencies, "managedDependencies cannot be null")); this.verbose = verbose; - this.pathScope = Objects.requireNonNull( pathScope, "pathScope cannot be null" ); + this.pathScope = Objects.requireNonNull(pathScope, "pathScope cannot be null"); this.pathTypeFilter = (pathTypeFilter != null) ? pathTypeFilter : (t) -> true; this.repositories = repositories; if (verbose && requestType != RequestType.COLLECT) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelBuilderRequest.java index 29d9bf79e4a..b5132f61afd 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelBuilderRequest.java @@ -142,23 +142,23 @@ enum RepositoryMerging { @Nonnull static ModelBuilderRequest build(@Nonnull ModelBuilderRequest request, @Nonnull ModelSource source) { - return builder( Objects.requireNonNull( request, "request cannot be null" ) ) - .source( Objects.requireNonNull( source, "source cannot be null" ) ) + return builder(Objects.requireNonNull(request, "request cannot be null")) + .source(Objects.requireNonNull(source, "source cannot be null")) .build(); } @Nonnull static ModelBuilderRequest build(@Nonnull Session session, @Nonnull ModelSource source) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .source( Objects.requireNonNull( source, "source cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .source(Objects.requireNonNull(source, "source cannot be null")) .build(); } @Nonnull static ModelBuilderRequest build(@Nonnull Session session, @Nonnull Path path) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .source(ModelSource.fromPath(path)) .build(); } @@ -319,7 +319,7 @@ private static class DefaultModelBuilderRequest extends BaseRequest imp List repositories, ModelTransformer lifecycleBindingsInjector) { super(session); - this.requestType = Objects.requireNonNull( requestType, "requestType cannot be null" ); + this.requestType = Objects.requireNonNull(requestType, "requestType cannot be null"); this.locationTracking = locationTracking; this.recursive = recursive; this.source = source; diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelSource.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelSource.java index 6b2727ec0f0..18a7b872bba 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelSource.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelSource.java @@ -53,6 +53,6 @@ static ModelSource fromPath(@Nonnull Path path) { @Nonnull static ModelSource fromPath(@Nonnull Path path, @Nullable String location) { - return new PathSource( Objects.requireNonNull( path, "path cannot be null" ), location); + return new PathSource(Objects.requireNonNull(path, "path cannot be null"), location); } } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java index a5aedec13e3..89d39793dcb 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java @@ -64,16 +64,16 @@ public interface ProjectBuilderRequest { @Nonnull static ProjectBuilderRequest build(@Nonnull Session session, @Nonnull Source source) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .source( Objects.requireNonNull( source, "source cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .source(Objects.requireNonNull(source, "source cannot be null")) .build(); } @Nonnull static ProjectBuilderRequest build(@Nonnull Session session, @Nonnull Path path) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .path( Objects.requireNonNull( path, "path cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .path(Objects.requireNonNull(path, "path cannot be null")) .build(); } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java index 0f92e00574a..ca2caf5595f 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java @@ -94,7 +94,7 @@ static SettingsBuilderRequest build( @Nullable Source projectSettingsSource, @Nullable Source userSettingsSource) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .installationSettingsSource(installationSettingsSource) .projectSettingsSource(projectSettingsSource) .userSettingsSource(userSettingsSource) @@ -108,7 +108,7 @@ static SettingsBuilderRequest build( @Nullable Path projectSettingsPath, @Nullable Path userSettingsPath) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .installationSettingsSource( installationSettingsPath != null && Files.exists(installationSettingsPath) ? Source.fromPath(installationSettingsPath) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/Source.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/Source.java index 8ec31248abb..86001c430e4 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/Source.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/Source.java @@ -94,6 +94,6 @@ public interface Source { */ @Nonnull static Source fromPath(@Nonnull Path path) { - return new PathSource( Objects.requireNonNull( path, "path cannot be null" ) ); + return new PathSource(Objects.requireNonNull(path, "path cannot be null")); } } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java index 911938d8c00..9ed53960c3c 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java @@ -60,7 +60,7 @@ static ToolchainsBuilderRequest build( @Nullable Source installationToolchainsFile, @Nullable Source userToolchainsSource) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .installationToolchainsSource(installationToolchainsFile) .userToolchainsSource(userToolchainsSource) .build(); @@ -72,7 +72,7 @@ static ToolchainsBuilderRequest build( @Nullable Path installationToolchainsFile, @Nullable Path userToolchainsPath) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) .installationToolchainsSource( installationToolchainsFile != null && Files.exists(installationToolchainsFile) ? Source.fromPath(installationToolchainsFile) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionRangeResolverRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionRangeResolverRequest.java index 7cbcd4bb104..52c73478b1c 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionRangeResolverRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionRangeResolverRequest.java @@ -57,9 +57,8 @@ static VersionRangeResolverRequest build( @Nonnull ArtifactCoordinates artifactCoordinates, @Nullable List repositories) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .artifactCoordinates( - Objects.requireNonNull( artifactCoordinates, "artifactCoordinates cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .artifactCoordinates(Objects.requireNonNull(artifactCoordinates, "artifactCoordinates cannot be null")) .repositories(repositories) .build(); } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionResolverRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionResolverRequest.java index c05b03b85f2..582e4234370 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionResolverRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionResolverRequest.java @@ -48,9 +48,8 @@ public interface VersionResolverRequest { @Nonnull static VersionResolverRequest build(@Nonnull Session session, @Nonnull ArtifactCoordinates artifactCoordinates) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .artifactCoordinates( - Objects.requireNonNull( artifactCoordinates, "artifactCoordinates cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .artifactCoordinates(Objects.requireNonNull(artifactCoordinates, "artifactCoordinates cannot be null")) .build(); } @@ -60,9 +59,8 @@ static VersionResolverRequest build( @Nonnull ArtifactCoordinates artifactCoordinates, @Nullable List repositories) { return builder() - .session( Objects.requireNonNull( session, "session cannot be null" ) ) - .artifactCoordinates( - Objects.requireNonNull( artifactCoordinates, "artifactCoordinates cannot be null" ) ) + .session(Objects.requireNonNull(session, "session cannot be null")) + .artifactCoordinates(Objects.requireNonNull(artifactCoordinates, "artifactCoordinates cannot be null")) .repositories(repositories) .build(); }