Feedback for records: Accessors name() vs. getName()

Roman Elizarov elizarov at gmail.com
Thu Aug 27 15:55:00 UTC 2020


Brian,

thanks for the detailed answer.

> As I've hinted in other places, we want to generalize this notion of
accessor to classes that are not records;
(and interface, too, I suppose).

And that's exactly my conundrum. I'd really like to see some guidance in
this direction coming directly from Java and JVM platform. It would be best
to see it at the same moment when records are released. Otherwise, there is
a big risk of fragmentation in the ecosystem as different frameworks will
start coming with different incompatible ways to mark the method as an
accessor, the role that was historically a prerogative of "get" verb in the
name, but now will have to be done in some other ways in light of records.
As you correctly noted, frameworks will not have much choice but to
designate an annotation for this role. Even if a JVM platform just
introduces an annotation that does not do anything of much substance, but
declares a developer's intent to have an accessor method, it would still be
better than nothing and will help big time increasing consistency in the
JVM ecosystem, just like the notion of "getXxx" getter methods was once
brought in and codified by the JVM platform itself.

Sincerely,
Roman Elizarov


More information about the amber-dev mailing list