Class ConstantPool.Dynamic

    • Field Summary

       
      Method-Name, and location in the Constant-Pool Table
      Modifier and Type Field Description
      String name
      This stores the Method-Name of the Bootstrap-Method specified by this Method-Handle instance.
      int tableIndex
      The Constant-Pool Table-Index where this Reference is located
       
      Tag-Kind - first as a 'byte', but also as a 'boolean'
      Modifier and Type Field Description
      boolean dynamicOrInvokeDynamic
      This field will be assigned TRUE if-and-only-if field tag has been assigned 17.
      byte tag
      The Constant-Pool Tg-Kind associated with this instance.
       
      Bootstrap-Method Table-Index for this 'Dynamic' Record
      Modifier and Type Field Description
      int bootstrapMethodIndex
      The index into the Bootstrap Method Table, pointing to a bootstrap method definition in the `.class` file attributes.
       
      Relevant Record Indices within the Table
      Modifier and Type Field Description
      int nameAndTypeIndex
      The index into the constant pool, pointing to a ConstantPool.TAG_NAME_AND_TYPE Record / Structure that provides the name and type descriptor of this entry.
      int nameIndex
      The Constant in the Constant-Pool which may be found at the index specified by field nameAndTypeIndex is, itself, a "Record" of sorts; and contains two integer data fields in its Record.
      int typeIndex
      This stores the Java 'type' for a Method-Handle as a Constant.
    • Method Summary

       
      Methods: class java.lang.Object
      Modifier and Type Method Description
      boolean equals​(Object other)
      Check whether this instance equals parameter 'other'
      int hashCode()
      Generate a simple, efficient, hash-code for this instance.
      String toString()
      Generate a String representation for this instance.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • tableIndex

        🡇     🗕  🗗  🗖
        public final int tableIndex
        The Constant-Pool Table-Index where this Reference is located
        Code:
        Exact Field Declaration Expression:
         public final int tableIndex;
        
      • tag

        🡅  🡇     🗕  🗗  🗖
        public final byte tag
        The Constant-Pool Tg-Kind associated with this instance. This Java 'byte' may take one of only two values:



        The "Tag-Kind" for any Constant in a Java '.class' File's Constant-Pool are a byte-Value which occupies the first byte of the constant's definition in the byte[]-Array which was loaded from disk.
        Code:
        Exact Field Declaration Expression:
         public final byte tag;
        
      • dynamicOrInvokeDynamic

        🡅  🡇     🗕  🗗  🗖
        public final boolean dynamicOrInvokeDynamic
        This field will be assigned TRUE if-and-only-if field tag has been assigned 17. Tthe only other value which may be assigned to field tag is 18, when that field is equal to 18, this field be FALSE.

        boolean fields such as this are here purely to make life easier, occasionally.
        Code:
        Exact Field Declaration Expression:
         public final boolean dynamicOrInvokeDynamic;
        
      • bootstrapMethodIndex

        🡅  🡇     🗕  🗗  🗖
        public final int bootstrapMethodIndex
        The index into the Bootstrap Method Table, pointing to a bootstrap method definition in the `.class` file attributes.
        Code:
        Exact Field Declaration Expression:
         public final int bootstrapMethodIndex;
        
      • nameAndTypeIndex

        🡅  🡇     🗕  🗗  🗖
        public final int nameAndTypeIndex
        The index into the constant pool, pointing to a ConstantPool.TAG_NAME_AND_TYPE Record / Structure that provides the name and type descriptor of this entry.

        The Constant-Pool entry that is stored in the Table-Index specified by the integer in 'nameAndTypeIndex' is actually a 4 Byte Integer-Pair. The two integers that comprise a "Name And Type" Constant (a "record" or "Structure") are simply two Index-Pointers back into the Constant-Pool's Table.

        The first Index-Pointer is to a UTF-8 String storing the "name" of for the Method of the Method-Handle. The second Index-Poniter points to a Table-Index which contains the Method-Type - also stored as a UTF-8 String.
        Code:
        Exact Field Declaration Expression:
         public final int nameAndTypeIndex;
        
      • nameIndex

        🡅  🡇     🗕  🗗  🗖
        public final int nameIndex
        The Constant in the Constant-Pool which may be found at the index specified by field nameAndTypeIndex is, itself, a "Record" of sorts; and contains two integer data fields in its Record. The first integer is a Table Index-Pointer to a "name", and is represented by a UTF-8 Table-Constant.

        The Constant-Pool Table-Index for the UTF-8 String Constanta is saved as an integer in this public, final field.

        The second integer of the Two-Integer Data-Record (nameAndTypeIndex) stores a "Type as a String." The index for that UTF-8 String is stored in the public final field typeIndex.
        Code:
        Exact Field Declaration Expression:
         public final int nameIndex;
        
      • typeIndex

        🡅  🡇     🗕  🗗  🗖
        public final int typeIndex
        This stores the Java 'type' for a Method-Handle as a Constant. You should review the documented explanations for the fields nameAndTypeIndex and also for nameIndex for more information.
        Code:
        Exact Field Declaration Expression:
         public final int typeIndex;
        
      • name

        🡅  🡇     🗕  🗗  🗖
        public final java.lang.String name
        This stores the Method-Name of the Bootstrap-Method specified by this Method-Handle instance.
        Code:
        Exact Field Declaration Expression:
         public final String name;
        
    • Method Detail

      • equals

        🡅  🡇     🗕  🗗  🗖
        public boolean equals​(java.lang.Object other)
        Check whether this instance equals parameter 'other'
        Overrides:
        equals in class java.lang.Object
        Code:
        Exact Method Body:
         if (! (other instanceof ConstantPool.Dynamic)) return false;
        
         ConstantPool.Dynamic o = (ConstantPool.Dynamic) other;
        
         return 
                 (this.tableIndex                == o.tableIndex)
             &&  (this.tag                       == o.tag)
             &&  (this.dynamicOrInvokeDynamic    == o.dynamicOrInvokeDynamic)
             &&  (this.bootstrapMethodIndex      == o.bootstrapMethodIndex)
             &&  (this.nameAndTypeIndex          == o.nameAndTypeIndex)
             &&  (this.nameIndex                 == o.nameIndex)
             &&  (this.typeIndex                 == o.typeIndex)
             &&  Objects.equals(this.name, o.name);
        
      • hashCode

        🡅  🡇     🗕  🗗  🗖
        public int hashCode()
        Generate a simple, efficient, hash-code for this instance.
        Overrides:
        hashCode in class java.lang.Object
        Code:
        Exact Method Body:
         return this.tableIndex + this.bootstrapMethodIndex + this.nameAndTypeIndex;
        
      • toString

        🡅     🗕  🗗  🗖
        public java.lang.String toString()
        Generate a java.lang.String representation for this instance.
        Overrides:
        toString in class java.lang.Object
        Code:
        Exact Method Body:
         return
             "{\n" +
             "    tableIndex:             " + tableIndex + "\n" +
             "    tag:                    " + tag + " (" + (dynamicOrInvokeDynamic ? "Dynamic" : "Invoke-Dynamic") + ")\n" +
             "    dynamicOrInvokeDynamic: " + dynamicOrInvokeDynamic + "\n" +
             "    name:                   " + name + "\n" +
             "    bootstrapMethodIndex:   " + bootstrapMethodIndex + "\n" +
             "    nameAndTypeIndex:       " + nameAndTypeIndex + "\n" +
             "    nameIndex:              " + nameIndex + "\n" +
             "    typeIndex:              " + typeIndex + "\n" +
             "}";