gnodet commented on issue #11582: URL: https://github.com/apache/maven/issues/11582#issuecomment-5530720249
This is not a bug and the current naming is intentional. The record-accessor pattern (noun-only: `name()`, `value()`, `children()`) is the established convention for **immutable value types** in modern Java — not a personal preference deviation. The JDK itself has been using this pattern for interfaces and classes representing immutable/value-type objects since well before records existed: - `java.lang.module.ModuleDescriptor` (Java 9): `name()`, `version()`, `requires()`, `exports()`, `packages()` - `java.lang.ProcessHandle.Info` (Java 9): `command()`, `arguments()`, `user()` - `java.util.stream.Collector` (Java 8): `supplier()`, `accumulator()`, `combiner()`, `finisher()` - `java.net.http.HttpResponse` (Java 11): `statusCode()`, `body()`, `headers()`, `uri()` - `java.lang.constant.ClassDesc` (Java 12): `packageName()`, `displayName()` - `java.util.ServiceLoader.Provider` (Java 9): `type()` This is not something Oracle "half-assed with records in Java 17" — the convention predates records by almost a decade. Records merely formalized what the JDK was already doing: immutable data carriers use noun accessors, not `getX()` verb accessors. The `get` prefix convention is for JavaBeans — mutable objects with getters/setters. `XmlNode` is an immutable value type by contract. It has no setters, no mutation methods. The noun-accessor style correctly signals this immutability to users, which is exactly the intent of the Maven 4 API design. Several other hand-crafted API interfaces in Maven 4 follow the same pattern: `PathType.name()`, `PathType.id()`, `Lifecycle.Phase.name()`, `OsService.name()`, `CIInfo.name()`. Flipping the deprecation direction would: 1. Break the migration path for users who already moved from `getName()` to `name()` as the deprecation warnings directed 2. Create inconsistency with other Maven 4 API interfaces that use the same pattern 3. Go against the direction the JDK itself has taken for value types The `getX()` default methods exist solely as a compatibility bridge and are correctly deprecated for removal. -- 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]
