On 22.11.2019 22:41, Remi Forax wrote:
i wonder if some codes in the wild rely on that ?
I don't think some code does, but you never know.
There is perhaps a better way, as part of the branch nestmates of valhalla, 
Mandy has added a way to transfer a live object to a Class when defining it, 
with that you can send all the Methods as an array and in the bootstrap method 
of a condy, access to the right method by extracting it from the array using an 
index.
It will avoid the whole serialization/deserialization of Methods dance.

That is a better idea - and could be done today using Unsafe.defineAnonymousClass - If it didn't need a host class.

Here is an example:
   https://gist.github.com/forax/d0f0034190bc479b86ce977fb94ca176

I believe those changes are planned for Java 14 so will be integrated very soon.

It looks like the class is defined using Lookup.defineHiddenClassWithClassData - in the current proxy implementation there is no lookup object.
Also, I'm not sure if the defined proxy class needs to be findable.
In short: I did not do an evaluation on what unspecified parts of a proxy can be changed without breaking someones cod


Reply via email to