RFR: 8220607 Draft JEP: Hidden Classes
Mandy Chung
mandy.chung at oracle.com
Fri Dec 6 23:32:14 UTC 2019
On 12/6/19 2:51 PM, Brian Goetz wrote:
>
>> Another asymmetry between Lookup::defineClass and defineHiddenClass
>> is the return value, Class vs Lookup.
>>
>> It's trivial to get the class from a Lookup object but we can't go
>> the other way. If a framework wants to get Lookup from a hidden class
>> it just defines (e.g. get a MethodHandle and invoke), if dHC returned
>> a Class, the hidden class had to provide an entry point to return its
>> Lookup object. Such entry point has to be accessible to the
>> framework but it has to be cautious in leaking its full-power Lookup.
>
> For the reasons you give, this asymmetry doesn't bother me. Most
> users of dC will want the class; users of dHC will generally _need_
> the lookup.
>
>>
>> I have considered adding Lookup::defineClassAsLookup(byte[] bytes,
>> boolean initialize). Lookup::defineClass was added in JDK 9. I
>> haven't seen any request to initialize the class. So I think it can
>> be done as a separate enhancement. I will file a JBS issue.
>
> I agree that this should be a separate enhancement. I'd like to see
> this bit of unsafe removed too, but no need to hold up this train to
> get to that one.
>
https://bugs.openjdk.java.net/browse/JDK-8235521
Mandy
More information about the valhalla-dev
mailing list