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 byte
kind
Contains a Javabyte
.int
tableIndex
The Constant-Pool Table-Index where thisMethod-Handle
is locatedInstance-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 aString
byte
referencedTagKind
This 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 byte
KIND_GET_FIELD
Reference-Kind value forgetField
.static byte
KIND_GET_STATIC
Reference-Kind value forgetStatic
.static byte
KIND_INVOKE_INTERFACE
Reference-Kind value forinvokeInterface
.static byte
KIND_INVOKE_SPECIAL
Reference-Kind value forinvokeSpecial
.static byte
KIND_INVOKE_STATIC
Reference-Kind value forinvokeStatic
.static byte
KIND_INVOKE_VIRTUAL
Reference-Kind value forinvokeVirtual
.static byte
KIND_NEW_INVOKE_SPECIAL
Reference-Kind value fornewInvokeSpecial
.static byte
KIND_PUT_FIELD
Reference-Kind value forputField
.static byte
KIND_PUT_STATIC
Reference-Kind value forputStatic
.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.
-
-
-
Field Detail
-
tableIndex
public final int tableIndex
The Constant-Pool Table-Index where thisMethod-Handle
is located- Code:
- Exact Field Declaration Expression:
public final int tableIndex;
-
kind
public final byte kind
Contains a Javabyte
. Guaranteed to be equal to one of the 9static
byte
-Constant Fields (the various "kinds").
The complete list ofMethod Handle
'kinds' may be viewed in the documentation for thestatic
fieldhandleKindNames
. The table in the javadoc Documentation-Table there contains 'stringified' versions of all of thestatic
'kind'byte
constants also provided in this class.- Code:
- Exact Field Declaration Expression:
public final byte kind;
-
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-Reference
or aInterface-Method-Reference
- Code:
- Exact Field Declaration Expression:
public final int referencedIndex;
-
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
- Code:
- Exact Field Declaration Expression:
public final String referencedName;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_GET_FIELD = 1;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_GET_STATIC = 2;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_PUT_FIELD = 3;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_PUT_STATIC = 4;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_INVOKE_VIRTUAL = 5;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_INVOKE_STATIC = 6;
-
KIND_INVOKE_SPECIAL
public static final byte KIND_INVOKE_SPECIAL
Reference-Kind value forinvokeSpecial
. Used to invoke an instance method directly (e.g., viasuper
calls).- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_INVOKE_SPECIAL = 7;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_NEW_INVOKE_SPECIAL = 8;
-
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
- Code:
- Exact Field Declaration Expression:
public static final byte KIND_INVOKE_INTERFACE = 9;
-
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, final
Read-Only Lookup-Table, or by reviewing the following HTML-Table.
ThisReadOnlyList
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 forObject
-equality between'this'
instance and'other'
.- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- This may be any Java-Object
, but only an instance ofConstantPool.MethodHandle
will permit this method to returnTRUE
.- Returns:
TRUE
if-and-only-if parameter'other'
is an instance ofMethodHandle
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 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:
toString
in 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' + "}";
-
-