Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Jan 3, 2025
1 parent 2c3f20f commit e10d5cc
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
*/
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;
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;

/**
* A request for creating a {@link ArtifactCoordinates} object.
*
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ static ArtifactDeployerRequest build(
@Nonnull RemoteRepository repository,
@Nonnull Collection<ProducedArtifact> 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();
}

Expand Down Expand Up @@ -113,8 +113,8 @@ private static class DefaultArtifactDeployerRequest extends BaseRequest<Session>
@Nonnull Collection<ProducedArtifact> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
*
*
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ static ArtifactInstallerRequestBuilder builder() {
@Nonnull
static ArtifactInstallerRequest build(Session session, Collection<ProducedArtifact> 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();
}

Expand Down Expand Up @@ -88,7 +88,7 @@ static class DefaultArtifactInstallerRequest extends BaseRequest<Session> implem

DefaultArtifactInstallerRequest(@Nonnull Session session, @Nonnull Collection<ProducedArtifact> artifacts) {
super(session);
this.artifacts = unmodifiable( Objects.requireNonNull( artifacts, "artifacts cannot be null" ) );
this.artifacts = unmodifiable(Objects.requireNonNull(artifacts, "artifacts cannot be null"));
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ static ArtifactResolverRequestBuilder builder() {
static ArtifactResolverRequest build(
@Nonnull Session session, @Nonnull Collection<? extends ArtifactCoordinates> 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();
}

Expand All @@ -68,8 +68,8 @@ static ArtifactResolverRequest build(
@Nonnull Collection<? extends ArtifactCoordinates> coordinates,
List<RemoteRepository> 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();
}
Expand Down Expand Up @@ -118,7 +118,7 @@ private static class DefaultArtifactResolverRequest extends BaseRequest<Session>
@Nonnull Collection<? extends ArtifactCoordinates> coordinates,
@Nonnull List<RemoteRepository> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class BaseRequest<S extends ProtoSession> {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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())
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,17 +395,15 @@ static class DefaultDependencyResolverRequest extends BaseRequest<Session>
@Nullable Predicate<PathType> pathTypeFilter,
@Nullable List<RemoteRepository> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -319,7 +319,7 @@ private static class DefaultModelBuilderRequest extends BaseRequest<Session> imp
List<RemoteRepository> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ static VersionRangeResolverRequest build(
@Nonnull ArtifactCoordinates artifactCoordinates,
@Nullable List<RemoteRepository> 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();
}
Expand Down
Loading

0 comments on commit e10d5cc

Please sign in to comment.