Package Torello.Java.Additional
Class ConstantPool.MethodHandle
- java.lang.Object
-
- Torello.Java.Additional.ConstantPool.MethodHandle
-
- Enclosing class:
- ConstantPool
public static class ConstantPool.MethodHandle extends java.lang.Object
A class representing the "Reference-Kind" values associated with aMethod-Handle.Method-Handles use "Reference-Kinds" to describe the type of operation they perform, such as accessing fields or invoking methods.
Hi-Lited Source-Code:This File's Source Code:
- View Here: Torello/Java/Additional/ConstantPool.java
- Open New Browser-Tab: Torello/Java/Additional/ConstantPool.java
File Size: 10,989 Bytes Line Count: 261 '\n' Characters Found
Static-Data Builder:
- View Here: ../data-files/MethodHandleData.java
- Open New Browser-Tab: ../data-files/MethodHandleData.java
File Size: 1,522 Bytes Line Count: 36 '\n' Characters Found
-
-
Field Summary
Instance-Fields: Table-Index & Reference-Kind Modifier and Type Field Description bytekindContains a Javabyte.inttableIndexThe Constant-Pool Table-Index where thisMethod-Handleis locatedInstance-Fields: Data about the Method-Reference to which this Handle Points Modifier and Type Field Description intreferencedIndexPoints to a Constant in the Constant-Pool Table.StringreferencedNameThe name of the method or field to which this reference points, as aStringbytereferencedTagKindThis contains the actual Tag-Kind (as a Javabyte) of the Reference to which this handle points.Static-Fields: Constants for all Nine Method-Handle 'Kinds' Modifier and Type Field Description static byteKIND_GET_FIELDReference-Kind value forgetField.static byteKIND_GET_STATICReference-Kind value forgetStatic.static byteKIND_INVOKE_INTERFACEReference-Kind value forinvokeInterface.static byteKIND_INVOKE_SPECIALReference-Kind value forinvokeSpecial.static byteKIND_INVOKE_STATICReference-Kind value forinvokeStatic.static byteKIND_INVOKE_VIRTUALReference-Kind value forinvokeVirtual.static byteKIND_NEW_INVOKE_SPECIALReference-Kind value fornewInvokeSpecial.static byteKIND_PUT_FIELDReference-Kind value forputField.static byteKIND_PUT_STATICReference-Kind value forputStatic.Static-Fields: Maps 'Kinds' from a 'byte' to a String Modifier and Type Field Description static ReadOnlyList<String>handleKindNamesThis list is contains exactly 9 non-null entries.
-
-
-
Field Detail
-
tableIndex
public final int tableIndex
The Constant-Pool Table-Index where thisMethod-Handleis located
-
kind
public final byte kind
Contains a Javabyte. Guaranteed to be equal to one of the 9staticbyte-Constant Fields (the various "kinds").
The complete list ofMethod Handle'kinds' may be viewed in the documentation for thestaticfieldhandleKindNames. The table in the javadoc Documentation-Table there contains 'stringified' versions of all of thestatic'kind'byteconstants also provided in this class.
-
referencedIndex
public final int referencedIndex
Points to a Constant in the Constant-Pool Table. This Index-Pointer must be a pointer to one of the following:Field-Reference,Method-Referenceor aInterface-Method-Reference
-
referencedTagKind
public final byte referencedTagKind
-
referencedName
public final java.lang.String referencedName
The name of the method or field to which this reference points, as aString
-
KIND_GET_FIELD
public static final byte KIND_GET_FIELD
Reference-Kind value forgetField. Used to retrieve an instance field from an object.- See Also:
- Constant Field Values
-
KIND_GET_STATIC
public static final byte KIND_GET_STATIC
Reference-Kind value forgetStatic. Used to retrieve a static field from a class.- See Also:
- Constant Field Values
-
KIND_PUT_FIELD
public static final byte KIND_PUT_FIELD
Reference-Kind value forputField. Used to assign a value to an instance field.- See Also:
- Constant Field Values
-
KIND_PUT_STATIC
public static final byte KIND_PUT_STATIC
Reference-Kind value forputStatic. Used to assign a value to a static field.- See Also:
- Constant Field Values
-
KIND_INVOKE_VIRTUAL
public static final byte KIND_INVOKE_VIRTUAL
Reference-Kind value forinvokeVirtual. Used to invoke an instance method via virtual dispatch.- See Also:
- Constant Field Values
-
KIND_INVOKE_STATIC
public static final byte KIND_INVOKE_STATIC
Reference-Kind value forinvokeStatic. Used to invoke a static method.- See Also:
- Constant Field Values
-
KIND_INVOKE_SPECIAL
public static final byte KIND_INVOKE_SPECIAL
Reference-Kind value forinvokeSpecial. Used to invoke an instance method directly (e.g., viasupercalls).- See Also:
- Constant Field Values
-
KIND_NEW_INVOKE_SPECIAL
public static final byte KIND_NEW_INVOKE_SPECIAL
Reference-Kind value fornewInvokeSpecial. Used to invoke a class constructor.- See Also:
- Constant Field Values
-
KIND_INVOKE_INTERFACE
public static final byte KIND_INVOKE_INTERFACE
Reference-Kind value forinvokeInterface. Used to invoke a method declared in an interface.- See Also:
- Constant Field Values
-
handleKindNames
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 thisstatic, finalRead-Only Lookup-Table, or by reviewing the following HTML-Table.
ThisReadOnlyListcontains exactly 10 elements, and these elements are listed, explicitly, below:
Kind Number Kind Name 0: UNUSED1: "getField"2: "getStatic"3: "putField"4: "putStatic"5: "invokeVirtual"6: "invokeStatic"7: "invokeSpecial"8: "newInvokeSpecial"9: "invokeInterface"
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object other)
Checks forObject-equality between'this'instance and'other'.- Overrides:
equalsin classjava.lang.Object- Parameters:
other- This may be any Java-Object, but only an instance ofConstantPool.MethodHandlewill permit this method to returnTRUE.- Returns:
TRUEif-and-only-if parameter'other'is an instance ofMethodHandleand 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:
hashCodein classjava.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 readableString.- Overrides:
toStringin classjava.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' + "}";
-
-