implicit constructor translation?

Brian Goetz brian.goetz at oracle.com
Thu Jun 1 19:34:29 UTC 2023



On 6/1/2023 2:32 PM, Dan Heidinga wrote:
>
>
> On Thu, Jun 1, 2023 at 1:59 PM Brian Goetz <brian.goetz at oracle.com> wrote:
>
>     I think that there should be an explicit (and not synthetic)
>     method_info for the implicit constructor, with the obvious Code
>     attribute (`defaultvalue` / `areturn`.)
>
>
> I'm slightly concerned about having a Code attribute for the implicit 
> constructor as it allows agents (ClassFile load hook & redefinition) 
> to modify the bytecodes to be inconsistent with the VM's behaviour 
> given the VM won't actually call the implicit constructor.
>
> Telling users it's "as if" the VM called the implicit ctor and then 
> having the reflective behaviour be different after retransformation is 
> slightly uncomfortable.

I'm fine if the expansion of the constructor body happens at runtime 
rather than compile time; my suggestion was mostly "this is super-easy 
in the static compiler, why make more work for the JVM." But, if you're 
signing up for that work, I won't stop you....

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-experts/attachments/20230601/a1096fb0/attachment.htm>


More information about the valhalla-spec-experts mailing list