Reverse operation of ClassDesc::of

- liangchenblue at gmail.com
Fri Mar 17 06:24:38 UTC 2023


While using ClassDesc, I find that it is somewhat hard to convert it
to a binary or internal name as calling substring makes the code much
more complex, especially when we know that the given ClassDesc is a
class or interface.

Thus, I propose an API serving as the inverse of
ClassDesc::of(String), which takes a binary name from Class::getName
and returns a ClassDesc of a class or interface. The new API would be
parallel to existing Class::getName, and I am tempted to call it
ClassDesc::getName.

In addition, it may be of interest to expand the legal inputs of
ClassDesc::of(String) to accept whatever Class::forName(String) does,
notably array classes with names like [Ljava.lang.Object; or [I.

Chen Liang


More information about the classfile-api-dev mailing list