Repository navigation
Description
Add noun-style accessors to remaining @Immutable API types (deprecating old-style getXxx())
Background
Maven 4.1.0 started the migration of @Immutable API types to noun-style accessors (e.g. id(), type() instead of getId(), getType()), consistent with the immutable value-object pattern and established in JDK types like Record. The reference implementation is org.apache.maven.api.Repository, which now exposes id() and type() as the canonical accessors while getId() / getType() are deprecated (@Deprecated(since = "4.1.0", forRemoval = true)) with default implementations delegating to the new names.
This issue covers the remaining interfaces and targets 4.2.0.
This issue tracks the remaining @Immutable interfaces that still only expose the old getXxx() / isXxx() style and need the same treatment.
Scope
The following interfaces need new noun-style accessors added, with the old getters kept as @Deprecated(since = "4.2.0", forRemoval = true) default methods delegating to the new ones. Each new accessor should carry a @since 4.2.0 javadoc tag.
maven-api-core β org.apache.maven.api
Artifact
isSnapshot()β addboolean snapshot()
Dependency
isOptional()β addboolean optional()
Type
getLanguage()β addLanguage language()getExtension()β addString extension()getClassifier()β addString classifier()isIncludesDependencies()β addboolean includesDependencies()getPathTypes()β addSet<PathType> pathTypes()
Note:
Packaging.language()already exists as a noun-styledefaultmethod but it internally callstype().getLanguage()β onceType.language()is added, its body must be updated to calltype().language().
maven-api-core β org.apache.maven.api.services
Request
getSession()β addS session()getTrace()β addRequestTrace trace()
Result
getRequest()β addREQ request()
BuilderProblem
getSource()β addString source()getLineNumber()β addint lineNumber()getColumnNumber()β addint columnNumber()getLocation()β addString location()getException()β addException exception()getMessage()β addString message()getSeverity()β addSeverity severity()
RepositoryAwareRequest (extends Request)
getRepositories()β addList<RemoteRepository> repositories()
ArtifactCoordinatesFactoryRequest
getGroupId()β addString groupId()getArtifactId()β addString artifactId()getVersion()β addString version()getClassifier()β addString classifier()getExtension()β addString extension()getType()β addString type()getCoordinatesString()β addString coordinatesString()
ArtifactDeployerRequest
getRepository()β addRemoteRepository repository()getArtifacts()β addCollection<ProducedArtifact> artifacts()getRetryFailedDeploymentCount()β addint retryFailedDeploymentCount()
ArtifactFactoryRequest
getGroupId()β addString groupId()getArtifactId()β addString artifactId()getVersion()β addString version()getClassifier()β addString classifier()getExtension()β addString extension()getType()β addString type()
ArtifactInstallerRequest
getArtifacts()β addCollection<ProducedArtifact> artifacts()
ArtifactResolverRequest
getCoordinates()β addCollection<ArtifactCoordinates> coordinates()
DependencyCoordinatesFactoryRequest
getScope()β addDependencyScope scope()isOptional()β addboolean optional()getExclusions()β addCollection<Exclusion> exclusions()
DependencyResolverRequest
getRequestType()β addRequestType requestType()getProject()β addOptional<Project> project()getRootArtifact()β addOptional<Artifact> rootArtifact()getRoot()β addOptional<DependencyCoordinates> root()getDependencies()β addCollection<DependencyCoordinates> dependencies()getManagedDependencies()β addCollection<DependencyCoordinates> managedDependencies()getVerbose()β addboolean verbose()getPathScope()β addPathScope pathScope()getPathTypeFilter()β addPredicate<PathType> pathTypeFilter()getTargetVersion()β addVersion targetVersion()
ModelBuilderRequest
getSource()β addSource source()getRequestType()β addRequestType requestType()isLocationTracking()β addboolean locationTracking()isRecursive()β addboolean recursive()getProfiles()β addList<Profile> profiles()getActiveProfileIds()β addList<String> activeProfileIds()getInactiveProfileIds()β addList<String> inactiveProfileIds()getSystemProperties()β addMap<String, String> systemProperties()getUserProperties()β addMap<String, String> userProperties()getRepositoryMerging()β addRepositoryMerging repositoryMerging()getLifecycleBindingsInjector()β addLifecycleBindingsInjector lifecycleBindingsInjector()
ProjectBuilderRequest
getPath()β addOptional<Path> path()getSource()β addOptional<Source> source()isAllowStubModel()β addboolean allowStubModel()isRecursive()β addboolean recursive()isProcessPlugins()β addboolean processPlugins()getRepositories()β addList<RemoteRepository> repositories()
SettingsBuilderRequest
getInstallationSettingsSource()β addOptional<Source> installationSettingsSource()getProjectSettingsSource()β addOptional<Source> projectSettingsSource()getUserSettingsSource()β addOptional<Source> userSettingsSource()getInterpolationSource()β addOptional<UnaryOperator<String>> interpolationSource()
maven-api-core β org.apache.maven.api.services.xml
XmlReaderRequest
getPath()β addPath path()getRootDirectory()β addPath rootDirectory()getURL()β addURL url()(note: acronym, keep lowercaseurl()per Java convention, matchingRemoteRepository.url())getInputStream()β addInputStream inputStream()getReader()β addReader reader()getTransformer()β addTransformer transformer()isStrict()β addboolean strict()getModelId()β addString modelId()getLocation()β addString location()isAddDefaultEntities()β addboolean addDefaultEntities()
Implementation Pattern
Exact pattern from Repository.java:
// New noun-style accessor (canonical, abstract)
/**
* Gets the identifier of this repository.
*
* @return the (case-sensitive) identifier, never {@code null}
* @since 4.2.0
*/
@Nonnull
String id();
// Old getter kept as deprecated default delegating to the new accessor
@Nonnull
@Deprecated(since = "4.2.0", forRemoval = true)
default String getId() {
return id();
}For boolean properties using isXxx():
// New noun-style accessor
/**
* Returns whether this artifact is a snapshot.
*
* @since 4.2.0
*/
boolean snapshot();
// Old getter deprecated
@Deprecated(since = "4.2.0", forRemoval = true)
default boolean isSnapshot() {
return snapshot();
}For the builder inner classes and their concrete implementations (e.g. ArtifactDeployerRequest has a static inner ArtifactDeployerRequestBuilder), the builder class's concrete implementations of the getters should be updated to also implement the new noun-style methods, or the deprecated defaults on the interface will suffice.
Acceptance Criteria
- All listed
@Immutableinterfaces have noun-style accessor methods added. - All old
getXxx()/isXxx()methods on those interfaces are retained as@Deprecated(since = "4.2.0", forRemoval = true)defaultmethods delegating to the new accessor. - Existing callers of old getters continue to compile (binary + source compat preserved).
Packaging.language()body updated fromtype().getLanguage()totype().language().- Any internal Maven code that calls the old getters on these interfaces should be updated to use the new noun-style accessors (the deprecated wrappers exist for external consumers, not for in-tree code).
Activity
codewithsinchana commentedon Nov 5, 2026
I'd like to contribute a small, focused part of this issue by adding the noun-style
snapshot()accessor toArtifact, while retainingisSnapshot()as a deprecated compatibility method. I'll also update the relevant implementation and internal callers. Would this scope be suitable for a separate PR?codewithsinchana commentedon Nov 12, 2026
I've submitted a focused contribution for the
Artifact.snapshot()accessor as part of this issue. The change retainsisSnapshot()as a deprecated compatibility method. Thank you.