<div dir="ltr">Hopefully this is the right place to comment on this ticket: <a href="https://bugs.openjdk.org/browse/JDK-8317277">https://bugs.openjdk.org/browse/JDK-8317277</a><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The one permitted use of the current class instance, implicitly or
explicitly, is to write to instance fields of the class, either of the
form 'f = expr' or 'this.f = expr'.
<br>
<br>
(This deviates from the usual "pre-construction context" rules; TBD
whether we're expanding the set of permitted actions in a
pre-construction context (thus permitting field writes before a super()
call in *any* constructor), or whether we're introducing a slightly
different context that covers the space between the end of the 'super()'
call and the end of the constructor execution.)
</blockquote><div><br></div><div>Allowing assignment of instance fields was discussed as an option for JEP 447, but we said no mainly to take the conservative route i.e., not try to change too much at once.<br></div><div><br></div><div>If JEP 447 is going to allow pre-construction assignment of instance fields in value classes and we don't also extend that to identity classes, then it seems like we'd be creating a worst-of-both-worlds scenario: added specification & compiler complexity to provide a desirable new feature, but making it available only some of the time. The result will be developers having to maintain a more complex mental model in their heads regarding what rules apply when, and being frustrated by the seeming arbitrariness of the distinction.<br></div><div><br></div><div>So my vote would be that we allow the assignment of instance fields in identity classes as well. In theory that could happen in either JEP but probably JEP 447 makes more sense.<br></div><div><br></div><div>Also, I have a couple of totally unrelated questions about value classes...</div><div><br></div><div>1. If v is a value object, what does System.identityHashCode(v) return?</div><div>2. If V is a value class, is {Weak,Soft,Phantom}Reference<V> supported?<br></div><div><br></div><div>-Archie<br></div><div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Archie L. Cobbs<br></div></div></div>