Class ConstantPool.MethodHandle

    • Field Summary

       
      Instance-Fields: Table-Index & Reference-Kind
      Modifier and Type Field Description
      byte kind
      Contains a Java byte.
      int tableIndex
      The Constant-Pool Table-Index where this Method-Handle is located
       
      Instance-Fields: Data about the Method-Reference to which this Handle Points
      Modifier and Type Field Description
      int referencedIndex
      Points to a Constant in the Constant-Pool Table.
      String referencedName
      The name of the method or field to which this reference points, as a String
      byte referencedTagKind
      This contains the actual Tag-Kind (as a Java byte) of the Reference to which this handle points.
       
      Static-Fields: Constants for all Nine Method-Handle 'Kinds'
      Modifier and Type Field Description
      static byte KIND_GET_FIELD
      Reference-Kind value for getField.
      static byte KIND_GET_STATIC
      Reference-Kind value for getStatic.
      static byte KIND_INVOKE_INTERFACE
      Reference-Kind value for invokeInterface.
      static byte KIND_INVOKE_SPECIAL
      Reference-Kind value for invokeSpecial.
      static byte KIND_INVOKE_STATIC
      Reference-Kind value for invokeStatic.
      static byte KIND_INVOKE_VIRTUAL
      Reference-Kind value for invokeVirtual.
      static byte KIND_NEW_INVOKE_SPECIAL
      Reference-Kind value for newInvokeSpecial.
      static byte KIND_PUT_FIELD
      Reference-Kind value for putField.
      static byte KIND_PUT_STATIC
      Reference-Kind value for putStatic.
       
      Static-Fields: Maps 'Kinds' from a 'byte' to a String
      Modifier and Type Field Description
      static ReadOnlyList<String> handleKindNames
      This list is contains exactly 9 non-null entries.
    • Method Summary

       
      Methods: class java.lang.Object
      Modifier and Type Method Description
      boolean equals​(Object other)
      Checks for Object-equality between 'this' instance and 'other'.
      int hashCode()
      Generates a hash-code.
      String toString()
      Generate a human readable String.
      • 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 Method-Handle is located
        Code:
        Exact Field Declaration Expression:
         public final int tableIndex;
        
      • kind

        🡅  🡇     🗕  🗗  🗖
        public final byte kind
        Contains a Java byte. Guaranteed to be equal to one of the 9 static byte-Constant Fields (the various "kinds").

        The complete list of Method Handle 'kinds' may be viewed in the documentation for the static field handleKindNames. The table in the javadoc Documentation-Table there contains 'stringified' versions of all of the static 'kind' byte constants also provided in this class.
        Code:
        Exact Field Declaration Expression:
         public final byte kind;
        
      • referencedTagKind

        🡅  🡇     🗕  🗗  🗖
        public final byte referencedTagKind
        This contains the actual Tag-Kind (as a Java byte) of the Reference to which this handle points. This particular field may hold only one of three different values: 9, 10 or 11
        Code:
        Exact Field Declaration Expression:
         public final byte referencedTagKind;
        
      • referencedName

        🡅  🡇     🗕  🗗  🗖
        public final java.lang.String referencedName
        The name of the method or field to which this reference points, as a String
        Code:
        Exact Field Declaration Expression:
         public final String referencedName;
        
      • KIND_GET_FIELD

        🡅  🡇     🗕  🗗  🗖
        public static final byte KIND_GET_FIELD
        Reference-Kind value for getField. Used to retrieve an instance field from an object.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte KIND_GET_FIELD = 1;
        
      • KIND_INVOKE_VIRTUAL

        🡅  🡇     🗕  🗗  🗖
        public static final byte KIND_INVOKE_VIRTUAL
        Reference-Kind value for invokeVirtual. Used to invoke an instance method via virtual dispatch.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte KIND_INVOKE_VIRTUAL = 5;
        
      • KIND_INVOKE_SPECIAL

        🡅  🡇     🗕  🗗  🗖
        public static final byte KIND_INVOKE_SPECIAL
        Reference-Kind value for invokeSpecial. Used to invoke an instance method directly (e.g., via super calls).
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte KIND_INVOKE_SPECIAL = 7;
        
      • handleKindNames

        🡅  🡇         External-Java:    🗕  🗗  🗖
        public static final ReadOnlyList<java.lang.String> handleKindNames
        This list is contains exactly 9 non-null entries. Each entry in this list corresponds to one of the 9 Handle "Kind's"

        You may view the contents of this Lookup-Table by either clicking the "External Java" Button (directly above) to see the actual Data-File which loads this static, final Read-Only Lookup-Table, or by reviewing the following HTML-Table.

        This ReadOnlyList contains exactly 10 elements, and these elements are listed, explicitly, below:

        Kind Number Kind Name
        0: UNUSED
        1: "getField"
        2: "getStatic"
        3: "putField"
        4: "putStatic"
        5: "invokeVirtual"
        6: "invokeStatic"
        7: "invokeSpecial"
        8: "newInvokeSpecial"
        9: "invokeInterface"
        Code:
        Exact Field Declaration Expression:
         @SuppressWarnings("unchecked")
                 @LinkJavaSource(handle="MethodHandleData")
                 public static final ReadOnlyList<String> handleKindNames = 
                     (ReadOnlyList<String>) LFEC.readObjectFromFile_JAR
                         (ConstantPool.class, "data-files/data5.roaldat", true, ReadOnlyList.class);
        
    • Method Detail

      • equals

        🡅  🡇     🗕  🗗  🗖
        public boolean equals​(java.lang.Object other)
        Checks for Object-equality between 'this' instance and 'other'.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - This may be any Java-Object, but only an instance of ConstantPool.MethodHandle will permit this method to return TRUE.
        Returns:
        TRUE if-and-only-if parameter 'other' is an instance of MethodHandle and has identical field values.
        Code:
        Exact Method Body:
         if (! (other instanceof MethodHandle)) return false;
        
         final MethodHandle o = (MethodHandle) other;
        
         return
                 (this.tableIndex == o.tableIndex)
             &&  (this.kind == o.kind)
             &&  (this.referencedIndex == o.referencedIndex)
             &&  (this.referencedTagKind == o.referencedTagKind)
             &&  Objects.equals(this.referencedName, o.referencedName);
        
      • hashCode

        🡅  🡇     🗕  🗗  🗖
        public int hashCode()
        Generates a hash-code. Fulfills Java's Hash-Code reuirement.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a good attempt at an efficient, but fair hashcode.
        Code:
        Exact Method Body:
         return this.tableIndex + this.kind + this.referencedIndex;
        
      • toString

        🡅     🗕  🗗  🗖
        public java.lang.String toString()
        Generate a human readable String.
        Overrides:
        toString in class java.lang.Object
        Returns:
        'this' instance as a Java String
        Code:
        Exact Method Body:
         return
             "Method Handle:\n" +
             "{\n" +
             "    Handle's Table-Index:               " + this.tableIndex + '\n' +
             "    Referenced Item's Name:             " + this.referencedName + '\n' +
             "    Handle Kind:                        " + this.kind + '\n' +
        
             "    Handle Kind's Name:                 " +
                 MethodHandle.handleKindNames.get(this.kind) + '\n' +
        
             "    Referenced Item's Table-Index:      " + this.referencedIndex + '\n' +
             "    Referenced Item's Kind (as byte):   " + this.referencedTagKind + '\n' +
        
             "    Referenced Item's Kind (as String): " +
                 ConstantPool.tagNames.get(this.referencedTagKind) + '\n' +
             "}";