JDK-8230501: Class data support for hidden classes

Mandy Chung mandy.chung at oracle.com
Wed Nov 11 23:28:56 UTC 2020

On 11/11/20 1:52 PM, John Rose wrote:
> After we talked off-line, I realized that the “all
> elements are the same type” line is a canard,
> a red herring, or some other unwelcome animal.

I didn't think all elements should be of the same type.   Class data can 
be a bag of live objects with different types.

> I think we were right the first time!

I do think the index-based convention with the specified type is right.  
What I wasn't fully happy with `classDataAt` is why supporting List but 
not an array or Map.  We don't (and probably shouldn't) enforce the 
class data be an immutable list and map. `classDataAt` taking a (frozen) 
array may probably be more satisfying option although it's the user's 
error if they mutate the class data.

> P.S. One idea for cutting two functions down to one:
> Encode the selection process into the (otherwise useless)
> name argument of the C_NameAndType in the condy.
> $*      the ClassData object itself
> $0      element 0 of the ClassData
> $1      element 1 of the ClassData (and so on $2, …)
> (other)  reserved for future use

I went through this route but I like a distinct method taking an index 
parameter than using the name argument - the method signature and 
javadoc is clearer and explicit.    I won't concern one additional function.


More information about the valhalla-dev mailing list