gnodet commented on issue #11582:
URL: https://github.com/apache/maven/issues/11582#issuecomment-5532028715
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 `get` prefix):**
- **Java 17** — `RandomGeneratorFactory`: `name()`, `group()`,
`equidistribution()`
- **Java 21** — `StructuredTaskScope.Subtask`: `state()`, `get()`,
`exception()`
- **Java 22** — **Foreign Function & Memory API** (finalized):
- `MemoryLayout`: `byteSize()`, `name()`, `byteAlignment()`
- `MemorySegment`: `address()`, `byteSize()`, `scope()`
- `FunctionDescriptor`: `argumentLayouts()`, `returnLayout()`
- `AddressLayout`: `targetLayout()`
- **Java 24** — **Classfile API** (finalized — the largest new API added to
the JDK in years, dozens of interfaces, zero `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()`
- **Java 24** — `Gatherer`: `initializer()`, `integrator()`, `combiner()`,
`finisher()`
- **Java 24** — `MatchResult` (new method): `namedGroups()`
**`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.
--
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]