RFR: 8311084: Add typeSymbol() API for applicable constant pool entries

Brian Goetz briangoetz at openjdk.org
Thu Jun 29 13:28:57 UTC 2023


On Thu, 29 Jun 2023 09:59:30 GMT, Chen Liang <liach at openjdk.org> wrote:

> 5 Constant Pool entries, namely ConstantDynamicEntry, InvokeDynamicEntry, FieldRefEntry, MethodRefEntry, and InterfaceMethodRefEntry should have a typeSymbol() API to return the nominal/symbolic descriptor (ClassDesc or MethodTypeDesc).
> 
> This API is not added to NameAndTypeEntry itself, for a NameAndTypeEntry only knows if its type should be a field or method type from the other entries that refer to it.
> 
> This is one of the issues discussed in this mailing list thread: https://mail.openjdk.org/pipermail/classfile-api-dev/2023-June/000381.html

Marked as reviewed by briangoetz (Reviewer).

src/java.base/share/classes/jdk/internal/classfile/constantpool/ConstantDynamicEntry.java line 49:

> 47:     default ClassDesc typeSymbol() {
> 48:         return Util.fieldTypeSymbol(nameAndType());
> 49:     }

Usage of Util::fieldTypeSymbol in asSymbol() can be replaced with typeSymbol()

src/java.base/share/classes/jdk/internal/classfile/constantpool/InvokeDynamicEntry.java line 46:

> 44:     default MethodTypeDesc typeSymbol() {
> 45:         return Util.methodTypeSymbol(nameAndType());
> 46:     }

Similar comment as with CondyEntry -- reduce usage of Util::methodTypeSymbol in this class

-------------

PR Review: https://git.openjdk.org/jdk/pull/14706#pullrequestreview-1505281261
PR Review Comment: https://git.openjdk.org/jdk/pull/14706#discussion_r1246610565
PR Review Comment: https://git.openjdk.org/jdk/pull/14706#discussion_r1246616224


More information about the core-libs-dev mailing list