RFR: implementation for JEP 334: JVM Constants API

Brian Goetz brian.goetz at oracle.com
Thu May 24 20:48:23 UTC 2018

> EnumDesc and VarHandleDesc, those should be static inner classes of respectively Enum and VarHandle,
> they are not part of the main API but nice addons.

After some thought, I am inclined to agree.  Here's the rationale. There 
are some built in constant types; they have Desc counterparts in JLIC.  
Then there are types that are Constable, that need a companion subtype 
of DynamicConstantDesc.  These classes should bring their own.

What to call them?  Well, we could leave the names the same, which is 
wordy: Enum.EnumDesc, but plays nicely with static imports.  We could 
call them something like Descriptor, but then if static imported, they'd 
like conflict.  Or, cleverly, we could call them ConstantDesc, which if 
people static-imported them, would shoot their own feet, and therefore 
learn not to do that :)  I like the latter for its corrective behavior 
but I think the first is probably best.

More information about the amber-dev mailing list