<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 11, 2024 at 12:57 PM Alan Bateman <<a href="mailto:Alan.Bateman@oracle.com">Alan.Bateman@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<br>
<br>
<div>On 11/06/2024 18:19, David Lloyd wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div style="font-family:arial,helvetica,sans-serif">:<br>
</div>
</div>
<div class="gmail_quote">
<div><br>
</div>
<div>
<div style="font-family:arial,helvetica,sans-serif">I thought
that might be where Alan was headed with this. I would
support this solution; it would solve the problem for
conformant serialization libraries. If a class has a
`readObject`/etc. then we use it - we wouldn't care if it
was "natural" or generated. This also gives us the option
to allow the user to use `opens` selectively to opt-in to
special optimizations, without a major penalty if they do
not.</div>
<div style="font-family:arial,helvetica,sans-serif"><br>
</div>
<div style="font-family:arial,helvetica,sans-serif">Is there
already someone assigned for this task</div>
</div>
</div>
</div>
</blockquote>
<br>
Not to my knowledge so you have cycles to prototype and have these
methods return a MH that work like a "default"
readObject/writeObject then it would help the discussion.<br></div></blockquote><div><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I think I can come up with *at least* a prototype in the next week or two. I have one concern though. The `readObject` method, when defined by users, must by specification do one of two things before it may read values from the stream:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">* Call `OIS.defaultReadObject()`</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">* Call `OIS.readFields()`</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">In the latter case, we don't have a problem, but if the user class calls `defaultReadObject` then we're back in the boat of having to reflectively set the fields of the class. We could possibly solve this by creating a *new* accessor which creates a parallel version of the method which *always* sets fields reflectively, even if a `readObject` already exists on the class. I'm not sure if there is a better solution. There is a similar problem on the write side, however this involves reading fields rather than writing them (obviously).</div></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">- DML • he/him<br></div></div></div>