gnodet opened a new issue, #13035:
URL: https://github.com/apache/maven/issues/13035

   Following the discussion in #11582, the Maven 4 API should consistently use 
noun-style accessors (record-accessor pattern) for immutable value types, in 
line with modern JDK conventions (see [detailed 
analysis](https://github.com/apache/maven/issues/11582#issuecomment-5530720249)).
   
   Several hand-crafted API interfaces already follow this pattern (`XmlNode`, 
`PathType`, `Lifecycle.Phase`, `Packaging`, `ExtensibleEnum`, `OsService`, 
`CIInfo`). The remaining core value type interfaces should be migrated as well.
   
   ## Scope
   
   For each interface, add the noun-style accessor as the primary abstract 
method and convert the existing `getX()` to a `default` method delegating to 
it, annotated with `@Deprecated(since = "4.1.0", forRemoval = true)`. Boolean 
queries (`is*()`) and conversion methods (`to*()`) are left as-is.
   
   ### Interfaces to migrate
   
   | Interface | Accessors to add |
   |---|---|
   | `Artifact` | `groupId()`, `artifactId()`, `version()`, `baseVersion()`, 
`classifier()`, `extension()` |
   | `ArtifactCoordinates` | `groupId()`, `artifactId()`, `classifier()`, 
`versionConstraint()`, `extension()` |
   | `Dependency` | `type()`, `scope()` |
   | `DependencyCoordinates` | `type()`, `scope()`, `optional()` |
   | `DownloadedArtifact` | `path()` |
   | `Exclusion` | `groupId()`, `artifactId()` |
   | `Project` | `groupId()`, `artifactId()`, `version()`, `packaging()`, 
`model()`, `pomPath()`, `basedir()`, `rootDirectory()` |
   | `VersionConstraint` | `versionRange()`, `recommendedVersion()` |
   | `VersionRange` / `VersionRange.Boundary` | `upperBoundary()`, 
`lowerBoundary()`, `version()` |
   
   ~42 methods across 9 interfaces.
   
   ## Rationale
   
   Every new immutable type introduced in the JDK since Java 8 — unconstrained 
by pre-existing hierarchies — uses noun-style accessors exclusively. The 
`getX()` prefix is the JavaBeans convention for mutable components with 
getters/setters. See #11582 for the full JDK 8–25 survey.
   
   Related: #11582


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to