> Add a method `internalName` (name subject to discussion) to `ClassDesc`, > which allows easily obtaining a String for representation of a class constant > in CONSTANT_Class_info. > > The motivation of this API is that avoiding frequent String creations via > caching (enabled by this new API, will be in a separate patch) would speed up > Classfile API's [writing of simple class > files](https://github.com/openjdk/jdk/blob/master/test/micro/org/openjdk/bench/jdk/classfile/Write.java) > by 1/3. See > https://mail.openjdk.org/pipermail/classfile-api-dev/2023-April/000296.html > for more context. > > This API is futureproof: for Valhalla's Q-types, it will return their string > representation in CONSTANT_Class_info, which is most likely their full > descriptor string. > > Javadoc: > https://cr.openjdk.org/~liach/8306697/java.base/java/lang/constant/ClassDesc.html#internalName() > > For the method name: `internalName` is intuitive as it is almost like an > inverse operation of `ofInternalName`, but the concept of internal name only > applies to classes and interfaces (as described in [JVMS > 4.4.1](https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.4.1)) > and doesn't apply to arrays. And internal names (binary name in internal > form) is useless outside of CONSTANT_Class_info; other usages are already > covered by `descriptorString`. If we stay on the naming of "internal name" > (which I would prefer), we might expand it and potentially upgrade > `ofInternalName` to take care of future CONSTANT_Class_info content (like > Q-types)
Chen Liang has updated the pull request incrementally with one additional commit since the last revision: Unify ofInternalName and internalName, document about CONSTANT_Class_info, remove misleading JVMS 4.4.1 links ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13598/files - new: https://git.openjdk.org/jdk/pull/13598/files/38cf849d..4620ec2e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13598&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13598&range=00-01 Stats: 50 lines in 2 files changed: 25 ins; 14 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/13598.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13598/head:pull/13598 PR: https://git.openjdk.org/jdk/pull/13598