RFR: 8254275: Development to revise "value-based class" & apply to wrappers [v2]
Dan Smith
dlsmith at openjdk.java.net
Fri Oct 16 17:32:24 UTC 2020
On Wed, 14 Oct 2020 20:03:44 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Dan Smith has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Revise definition for more flexible ==. Apply revised boilerplate to wrappers and existing references.
>
> src/java.base/share/classes/java/lang/doc-files/ValueBased.html line 55:
>
>> 53: method must allow for the possibility that if two independently-produced
>> 54: instances are equal according to <code>equals()</code>, they may also be
>> 55: equal according to <code>==</code>;
>
> Is using "may" a way to allow contradiction of the previous requirements?
> Otherwise, in a spec, any statement using 'may' can be ignored or removed, it does not specify any behavior either
> required or disallowed.
What I'm going for is "may declare factory methods, and if they do then...". But you're right, it doesn't work as
written. I'll rephrase. (Why not require a factory method? Because a class could also just define a handful of named
instances, enum-style, and not expose any factory-like behavior. Boolean is almost an example of this, although it does
have a 'valueOf' method, too.)
-------------
PR: https://git.openjdk.java.net/valhalla/pull/222
More information about the valhalla-dev
mailing list