You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For inobvious reasons methods that follow Java conventions like getChild and getValue have been deprecated and replaced with methods that don't like child() and value(). This is confusing and unnecessary churn. Revert this.
One can argue about the wisdom of Java's well-established naming conventions, but individual projects like Maven should not needlessly deviate from those for personal preference. It's far easier to stick with existing convention than for every project to pave its own way.
And yes, Oracle did a half-assed job when they added records to the language in Java 17 without considering the impact on naming conventions for existing code. That neither conformed to nor changed existing conventions for non-record classes and interfaces.
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:
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:
Break the migration path for users who already moved from getName() to name() as the deprecation warnings directed
Create inconsistency with other Maven 4 API interfaces that use the same pattern
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 dramatically overstates the case and cherry picks evidence from a few random classes. This reversal of convention simply did not happen in Java 8. Maybe it started to pick up around Java 11, but I simply do not think it is reasonable to claim that this is the preferred or expected convention even in Java 26. Yes, both are used today but one has an explicit mandate and design going back 30 years and one doesn't. The mistake made here was to deprecate the existing methods that are already used and impose unnecessary costs on clients because of personal preference. Unfortunately that's a mistake that's been made again and again across Maven 4 APIs. This is hardly the only example. Lots of deprecation and API churn that makes the system more complex for no particular benefit. It prioritizes the preferences of some committers over the desire of the large installed base for compatible APIs that just work. Maven 4 hasn't shipped, so all this can still be fixed, but that does require refocusing on actual user facing features instead of random changes that deliver only negative user value.
To be thorough, here is a more comprehensive survey of every new immutable type/interface introduced in the JDK since Java 13, looking at both noun-style and getX()-style accessors:
getX()-style accessors on newly introduced immutable types:
Java 16 — UnixDomainSocketAddress: getPath() — however, this class extends SocketAddress (Java 1.4) and follows the pre-existing InetSocketAddress.getPort()/getHostName() convention from the same hierarchy.
That is the only counter-example found, and it is constrained by a legacy class hierarchy. Every genuinely new immutable type or interface introduced since Java 13 — unconstrained by pre-existing hierarchies — uses noun-style accessors exclusively. The Classfile API alone, finalized in JDK 24, is a massive data point: a large, carefully designed API by the OpenJDK team with fields(), not getFields(); methodName(), not getMethodName().
This is not cherry-picking — it is the complete picture.
getX()-style accessors on newly introduced immutable types:
Java 9 — StackWalker.StackFrame: getClassName(), getMethodName(), getFileName(), getLineNumber(), getByteCodeIndex() — however, this interface was deliberately designed to mirror StackTraceElement (Java 1.4), and even provides a toStackTraceElement() conversion method. The naming follows the pre-existing class it mirrors.
So across the entire JDK 8–25 range, the only two counter-examples are StackWalker.StackFrame (mirrors StackTraceElement from Java 1.4) and UnixDomainSocketAddress (extends SocketAddress from Java 1.4). Both are constrained by pre-existing APIs. Every genuinely new immutable type — unconstrained by legacy — uses noun-style accessors.
Activity
elharo commentedon Dec 21, 2025
Apparently I approved this one in #2150
Not sure what I was thinking. I probably needed more coffee.
gnodet commentedon Sep 3, 2026
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. Thegetprefix convention is for JavaBeans — mutable objects with getters/setters.XmlNodeis 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:
getName()toname()as the deprecation warnings directedThe
getX()default methods exist solely as a compatibility bridge and are correctly deprecated for removal.elharo commentedon Sep 3, 2026
This dramatically overstates the case and cherry picks evidence from a few random classes. This reversal of convention simply did not happen in Java 8. Maybe it started to pick up around Java 11, but I simply do not think it is reasonable to claim that this is the preferred or expected convention even in Java 26. Yes, both are used today but one has an explicit mandate and design going back 30 years and one doesn't. The mistake made here was to deprecate the existing methods that are already used and impose unnecessary costs on clients because of personal preference. Unfortunately that's a mistake that's been made again and again across Maven 4 APIs. This is hardly the only example. Lots of deprecation and API churn that makes the system more complex for no particular benefit. It prioritizes the preferences of some committers over the desire of the large installed base for compatible APIs that just work. Maven 4 hasn't shipped, so all this can still be fixed, but that does require refocusing on actual user facing features instead of random changes that deliver only negative user value.
gnodet commentedon Sep 3, 2026
To be thorough, here is a more comprehensive survey of every new immutable type/interface introduced in the JDK since Java 13, looking at both noun-style and
getX()-style accessors:Noun-style accessors (no
getprefix):RandomGeneratorFactory:name(),group(),equidistribution()StructuredTaskScope.Subtask:state(),get(),exception()MemoryLayout:byteSize(),name(),byteAlignment()MemorySegment:address(),byteSize(),scope()FunctionDescriptor:argumentLayouts(),returnLayout()AddressLayout:targetLayout()getX()methods):ClassModel:fields(),methods(),interfaces(),flags(),superclass(),thisClass(),constantPool(),majorVersion(),minorVersion()MethodModel:methodName(),methodType(),code(),flags(),parent()FieldModel:fieldName(),fieldType(),flags(),parent()Annotation:className(),elements()TypeKind:upperBound(),slotSize()Gatherer:initializer(),integrator(),combiner(),finisher()MatchResult(new method):namedGroups()getX()-style accessors on newly introduced immutable types:UnixDomainSocketAddress:getPath()— however, this class extendsSocketAddress(Java 1.4) and follows the pre-existingInetSocketAddress.getPort()/getHostName()convention from the same hierarchy.That is the only counter-example found, and it is constrained by a legacy class hierarchy. Every genuinely new immutable type or interface introduced since Java 13 — unconstrained by pre-existing hierarchies — uses noun-style accessors exclusively. The Classfile API alone, finalized in JDK 24, is a massive data point: a large, carefully designed API by the OpenJDK team with
fields(), notgetFields();methodName(), notgetMethodName().This is not cherry-picking — it is the complete picture.
gnodet commentedon Sep 3, 2026
And for completeness, the same survey for JDK 8–12 — every new immutable type/interface introduced in this range, checking both accessor styles:
Noun-style accessors (no
getprefix):Collector:supplier(),accumulator(),combiner(),finisher(),characteristics()ModuleDescriptor:name(),version(),requires(),exports(),opens(),uses(),provides(),packages(),modifiers()ModuleDescriptor.Exports:source(),targets(),modifiers()ModuleDescriptor.Requires:name(),modifiers(),compiledVersion()ModuleDescriptor.Provides:service(),providers()ModuleReference:descriptor(),location()ProcessHandle:pid(),info(),parent(),children()ProcessHandle.Info:command(),arguments(),user(),startInstant(),totalCpuDuration(),commandLine()ServiceLoader.Provider:type()HttpClient:authenticator(),connectTimeout(),cookieHandler(),executor(),followRedirects(),proxy(),sslContext(),sslParameters(),version()HttpRequest:method(),uri(),headers(),bodyPublisher(),expectContinue(),timeout(),version()HttpResponse:statusCode(),body(),headers(),uri(),version()ClassDesc:packageName(),displayName()MethodTypeDesc:returnType(),parameterCount(),parameterList(),parameterArray()DirectMethodHandleDesc:kind(),methodName(),owner(),lookupDescriptor(),refKind()DynamicConstantDesc:bootstrapArgs(),bootstrapMethod(),constantName(),constantType()getX()-style accessors on newly introduced immutable types:StackWalker.StackFrame:getClassName(),getMethodName(),getFileName(),getLineNumber(),getByteCodeIndex()— however, this interface was deliberately designed to mirrorStackTraceElement(Java 1.4), and even provides atoStackTraceElement()conversion method. The naming follows the pre-existing class it mirrors.So across the entire JDK 8–25 range, the only two counter-examples are
StackWalker.StackFrame(mirrorsStackTraceElementfrom Java 1.4) andUnixDomainSocketAddress(extendsSocketAddressfrom Java 1.4). Both are constrained by pre-existing APIs. Every genuinely new immutable type — unconstrained by legacy — uses noun-style accessors.