Hello, While looking at ConstantDesc.resolveConstantDesc, I find that user code cannot call resolveConstantDesc without extra casts for these types of constant descriptors: ClassDesc, MethodTypeDesc, MethodHandleDesc. Other constant descriptors can have their constants resolved without casts: Double, DynamicConstantDesc, Float, Integer, Long, String.
This appears as a design flaw to me, as in the implementation of the 3 cast-required types, their return types are Class, MethodType, and MethodHandle respectively. However, these implementations are not visible to users, so they cannot be benefitted by the more specific return types in the implementations (unlike the VarHandleDesc and EnumDesc, which are public). If this is valid, I propose to add covariant overrides to resolveConstantDesc in the ClassDesc, MethodTypeDesc, and MethodHandleDesc interfaces. These should have little backward compatibility concerns as these interfaces are already sealed. I can open an issue on JBS and submit a patch. Chen Liang