File tree Expand file tree Collapse file tree 7 files changed +48
-4
lines changed
src/java.base/share/classes/jdk/internal/classfile Expand file tree Collapse file tree 7 files changed +48
-4
lines changed Original file line number Diff line number Diff line change 2626
2727import jdk .internal .classfile .TypeKind ;
2828import jdk .internal .classfile .impl .Util ;
29+
30+ import java .lang .constant .ClassDesc ;
2931import java .lang .constant .ConstantDesc ;
3032import java .lang .constant .DynamicConstantDesc ;
3133
@@ -40,6 +42,13 @@ public sealed interface ConstantDynamicEntry
4042 extends DynamicConstantPoolEntry , LoadableConstantEntry
4143 permits AbstractPoolEntry .ConstantDynamicEntryImpl {
4244
45+ /**
46+ * {@return a symbolic descriptor for the dynamic constant's type}
47+ */
48+ default ClassDesc typeSymbol () {
49+ return Util .fieldTypeSymbol (nameAndType ());
50+ }
51+
4352 @ Override
4453 default ConstantDesc constantValue () {
4554 return asSymbol ();
@@ -51,7 +60,7 @@ default ConstantDesc constantValue() {
5160 default DynamicConstantDesc <?> asSymbol () {
5261 return DynamicConstantDesc .ofNamed (bootstrap ().bootstrapMethod ().asSymbol (),
5362 name ().stringValue (),
54- Util . fieldTypeSymbol ( nameAndType () ),
63+ typeSymbol ( ),
5564 bootstrap ().arguments ().stream ()
5665 .map (LoadableConstantEntry ::constantValue )
5766 .toArray (ConstantDesc []::new ));
Original file line number Diff line number Diff line change 2525package jdk .internal .classfile .constantpool ;
2626
2727import jdk .internal .classfile .impl .AbstractPoolEntry ;
28+ import jdk .internal .classfile .impl .Util ;
29+
30+ import java .lang .constant .ClassDesc ;
2831
2932/**
3033 * Models a {@code CONSTANT_Fieldref_info} constant in the constant pool of a
3437public sealed interface FieldRefEntry extends MemberRefEntry
3538 permits AbstractPoolEntry .FieldRefEntryImpl {
3639
40+ /**
41+ * {@return a symbolic descriptor for the field's type}
42+ */
43+ default ClassDesc typeSymbol () {
44+ return Util .fieldTypeSymbol (nameAndType ());
45+ }
3746}
Original file line number Diff line number Diff line change 2525package jdk .internal .classfile .constantpool ;
2626
2727import jdk .internal .classfile .impl .AbstractPoolEntry ;
28+ import jdk .internal .classfile .impl .Util ;
29+
30+ import java .lang .constant .MethodTypeDesc ;
2831
2932/**
3033 * Models a {@code CONSTANT_InterfaceMethodRef_info} constant in the constant pool of a
@@ -35,4 +38,10 @@ public sealed interface InterfaceMethodRefEntry
3538 extends MemberRefEntry
3639 permits AbstractPoolEntry .InterfaceMethodRefEntryImpl {
3740
41+ /**
42+ * {@return a symbolic descriptor for the interface method's type}
43+ */
44+ default MethodTypeDesc typeSymbol () {
45+ return Util .methodTypeSymbol (nameAndType ());
46+ }
3847}
Original file line number Diff line number Diff line change 2626
2727import java .lang .constant .ConstantDesc ;
2828import java .lang .constant .DynamicCallSiteDesc ;
29+ import java .lang .constant .MethodTypeDesc ;
2930
3031import jdk .internal .classfile .impl .AbstractPoolEntry ;
3132import jdk .internal .classfile .impl .Util ;
@@ -38,13 +39,20 @@ public sealed interface InvokeDynamicEntry
3839 extends DynamicConstantPoolEntry
3940 permits AbstractPoolEntry .InvokeDynamicEntryImpl {
4041
42+ /**
43+ * {@return a symbolic descriptor for the call site's invocation type}
44+ */
45+ default MethodTypeDesc typeSymbol () {
46+ return Util .methodTypeSymbol (nameAndType ());
47+ }
48+
4149 /**
4250 * {@return a symbolic descriptor for the dynamic call site}
4351 */
4452 default DynamicCallSiteDesc asSymbol () {
4553 return DynamicCallSiteDesc .of (bootstrap ().bootstrapMethod ().asSymbol (),
4654 name ().stringValue (),
47- Util . methodTypeSymbol ( nameAndType () ),
55+ typeSymbol ( ),
4856 bootstrap ().arguments ().stream ()
4957 .map (LoadableConstantEntry ::constantValue )
5058 .toArray (ConstantDesc []::new ));
Original file line number Diff line number Diff line change 2525package jdk .internal .classfile .constantpool ;
2626
2727import jdk .internal .classfile .impl .AbstractPoolEntry ;
28+ import jdk .internal .classfile .impl .Util ;
29+
30+ import java .lang .constant .MethodTypeDesc ;
2831
2932/**
3033 * Models a {@code CONSTANT_MethodRef_info} constant in the constant pool of a
3437public sealed interface MethodRefEntry extends MemberRefEntry
3538 permits AbstractPoolEntry .MethodRefEntryImpl {
3639
40+ /**
41+ * {@return a symbolic descriptor for the method's type}
42+ */
43+ default MethodTypeDesc typeSymbol () {
44+ return Util .methodTypeSymbol (nameAndType ());
45+ }
3746}
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ default Utf8Entry type() {
7777 * {@return a symbolic descriptor for the type of the field}
7878 */
7979 default ClassDesc typeSymbol () {
80- return Util . fieldTypeSymbol ( field ().nameAndType () );
80+ return field ().typeSymbol ( );
8181 }
8282
8383 /**
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ default Utf8Entry type() {
7070 * {@return the invocation type of the call site, as a symbolic descriptor}
7171 */
7272 default MethodTypeDesc typeSymbol () {
73- return Util . methodTypeSymbol ( invokedynamic ().nameAndType () );
73+ return invokedynamic ().typeSymbol ( );
7474 }
7575
7676 /**
You can’t perform that action at this time.
0 commit comments