gnodet commented on PR #14068:
URL: https://github.com/apache/maven/pull/14068#issuecomment-7040916404

   @elharo — thanks for the review. I want to address the \"needless churn\" 
concern directly.
   
   **This is not a naming fashion choice.** Maven 4's \`@Immutable\` interfaces 
are value types — no setters, no mutable state. The natural Java expression for 
a value type is a **record**. Records define their accessors as noun-style by 
language specification: \`groupId()\`, not \`getGroupId()\`. Records can 
implement interfaces; when they do, a component \`String groupId\` satisfies 
\`String groupId()\` automatically — zero boilerplate. If the interface 
declares \`String getGroupId()\`, the record needs an explicit override for 
every field, defeating the purpose entirely.
   
   **We can't use records today** because:
   - The generated model has inheritance chains (\`Model extends ModelBase\`) — 
records cannot extend classes
   - Request/result types use builder patterns that records don't natively 
support yet
   
   These are Java language constraints, not semantic ones. The types *are* 
value types; they just can't *be* records yet. Noun-style now is what makes 
these interfaces record-ready when the language catches up.
   
   **The JDK itself has applied this consistently** to every new immutable type 
introduced since Java 8 — \`Collector\`, \`ModuleDescriptor\`, 
\`HttpRequest\`/\`HttpResponse\`, the entire Java 24 Classfile API (dozens of 
interfaces, zero \`getX()\` methods). The two JDK counter-examples 
(\`StackWalker.StackFrame\`, \`UnixDomainSocketAddress\`) are both constrained 
by pre-existing legacy hierarchies — exactly the situation Maven 4 is not in.
   
   **On consistency:** Maven 4's \`@Immutable\` hand-written interfaces already 
use noun-style in several places (\`Repository.id()\`, \`Repository.type()\`, 
\`PathType\`, \`Lifecycle.Phase\`, \`OsService\`, \`XmlNode\`). The generated 
model classes still use \`getX()\`. This PR fixes an existing inconsistency — 
it doesn't introduce a new one.
   
   **On binary compatibility:** no existing method is removed. All \`getX()\` 
methods are retained as deprecated defaults. External callers pay zero cost 
immediately. This was discussed at length in #11582 before 4.0 GA, which is 
exactly the right time for it.
   
   The full design rationale is in #11582 and in my [earlier 
comment](https://github.com/apache/maven/pull/14068#issuecomment-7014195558) on 
this PR.


-- 
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