On 6/1/2023 2:32 PM, Dan Heidinga wrote:
On Thu, Jun 1, 2023 at 1:59 PM Brian Goetz <[email protected]> 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....