Clarifying record reflective support

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Dec 4 15:59:24 UTC 2019


On 04/12/2019 15:53, forax at univ-mlv.fr wrote:
> Like getEnumConstants(), this is an argument i can agree upon.
Yes, that is the important precedent here.
>
> But during the scanning of the methods of java.lang.Class, i've 
> discovered that describeConstable() already returns an Optional.
describeConstable appears in Class javadoc, but is NOT defined there. 
It's defined in the Constable interface. So there's an argument there in 
favor of treating it differently.
>
> So i vote for returning an Optional. I'm sure there is a quote from 
> you somewhere saying that Optional is better than null.

Of all the methods _defined_ in Class there's no method returning 
Optional. Adding one would be to have 3 ways to do the same thing in the 
very same class. Not undoable - but questionable.

Maurizio



More information about the amber-spec-experts mailing list