Switch core API value types to noun-style accessors - #13036
Conversation
Add noun-style accessors (record-accessor pattern) to core API interfaces for immutable value types, consistent with modern JDK conventions and existing Maven 4 API types (XmlNode, PathType, Lifecycle.Phase, etc.). For each method, the noun-style accessor is now the primary abstract method. The existing getX() method is kept as a default delegating to it, annotated @deprecated(since = "4.1.0", forRemoval = true). Interfaces migrated: Artifact, ArtifactCoordinates, Dependency, DependencyCoordinates, DownloadedArtifact, Exclusion, Project, VersionConstraint, VersionRange. Fixes #13035
46f6cdb to
c0f25d3
Compare
gnodet
left a comment
There was a problem hiding this comment.
Inconsistent getGroupId() calls left unconverted
The migration is clean and mechanically consistent across 9 interfaces and all implementations. One minor gap: three getGroupId() calls in the factory request classes were missed while adjacent accessors on the same object were converted to noun-style.
This review was generated by an AI agent, Hermès, on behalf of @gnodet.
| @@ -97,10 +97,10 @@ static ArtifactCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnul | |||
| return ArtifactCoordinatesFactoryRequest.builder() | |||
| .session(requireNonNull(session, "session")) | |||
| .groupId(requireNonNull(coordinates, "coordinates").getGroupId()) | |||
There was a problem hiding this comment.
getGroupId() on the requireNonNull() return was not converted to groupId(), while artifactId(), classifier(), versionConstraint(), and extension() on the same object (next lines) were.
| .groupId(requireNonNull(coordinates, "coordinates").getGroupId()) | |
| .groupId(requireNonNull(coordinates, "coordinates").groupId()) |
| @@ -77,10 +77,10 @@ static DependencyCoordinatesFactoryRequest build( | |||
| .session(requireNonNull(session, "session cannot be null")) | |||
| .groupId(requireNonNull(coordinates, "coordinates cannot be null") | |||
| .getGroupId()) | |||
There was a problem hiding this comment.
Same missed conversion — getGroupId() left as-is while the rest of the chain uses noun-style.
| .getGroupId()) | |
| .groupId()) |
| @@ -89,12 +89,12 @@ static DependencyCoordinatesFactoryRequest build(@Nonnull Session session, @Nonn | |||
| return builder() | |||
| .session(requireNonNull(session, "session cannot be null")) | |||
| .groupId(requireNonNull(dependency, "dependency").getGroupId()) | |||
There was a problem hiding this comment.
Same pattern — getGroupId() not converted.
| .groupId(requireNonNull(dependency, "dependency").getGroupId()) | |
| .groupId(requireNonNull(dependency, "dependency").groupId()) |
gnodet
left a comment
There was a problem hiding this comment.
Re-review after e8c3ae3: the three getGroupId() calls flagged in the previous review are now converted to groupId(). Migration is mechanically consistent across all 9 interfaces, all implementations, all tests, and all internal callers. No remaining unconverted calls found.
LGTM — no issues.
This review was generated by an AI agent, Hermès, on behalf of @gnodet.
Add noun-style accessors (record-accessor pattern) to core API interfaces for immutable value types, consistent with modern JDK conventions and existing Maven 4 API types (
XmlNode,PathType,Lifecycle.Phase, etc.).For each method, the noun-style accessor is now the primary abstract method. The existing
getX()method is kept as a default delegating to it, annotated@Deprecated(since = "4.1.0", forRemoval = true).Interfaces migrated:
Artifact,ArtifactCoordinates,Dependency,DependencyCoordinates,DownloadedArtifact,Exclusion,Project,VersionConstraint,VersionRange.24 files changed, 821 insertions, 212 deletions.
Fixes #13035