APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.jfr.internal.util

public final Class Bytecode

extends Object
Class Inheritance
Imports
jdk.jfr.ValueDescriptor, java.lang.constant.ClassDesc, .ConstantDescs, .MethodTypeDesc, java.util.Objects, jdk.jfr.internal.Logger, .LogLevel, .LogTag, java.lang.classfile.CodeBuilder, .MethodModel, .ClassModel, .ClassFile, jdk.internal.classfile.components.ClassPrinter

Helper class when working with bytecode.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
public static record
public static record
public static record

Field Summary

Modifier and TypeField and Description
private static final ClassDesc

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ClassDesc
public static ClassDesc
classDesc(Class<?> clazz)

public static String
public static void
getfield(CodeBuilder codeBuilder, ClassDesc owner, Bytecode.FieldDesc field)

public static String
internalName(String className)

public static void
public static void
public static void
public static void
public static void
log(String className, byte[] bytes)

public static void
putfield(CodeBuilder codeBuilder, ClassDesc owner, Bytecode.FieldDesc field)

public static void
public static void
unbox(CodeBuilder codeBuilder, ClassDesc type)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CD_Threadback to summary
private static final ClassDesc CD_Thread

Constructor Detail

Bytecodeback to summary
public Bytecode()

Method Detail

classDescback to summary
public static ClassDesc classDesc(ValueDescriptor v)
classDescback to summary
public static ClassDesc classDesc(Class<?> clazz)
descriptorNameback to summary
public static String descriptorName(String className)
getfieldback to summary
public static void getfield(CodeBuilder codeBuilder, ClassDesc owner, Bytecode.FieldDesc field)
internalNameback to summary
public static String internalName(String className)
invokespecialback to summary
public static void invokespecial(CodeBuilder codeBuilder, ClassDesc owner, Bytecode.MethodDesc method)
invokestaticback to summary
public static void invokestatic(CodeBuilder codeBuilder, ClassDesc owner, Bytecode.MethodDesc method)
invokevirtualback to summary
public static void invokevirtual(CodeBuilder codeBuilder, ClassDesc owner, Bytecode.MethodDesc method)
invokevirtualback to summary
public static void invokevirtual(CodeBuilder codeBuilder, Bytecode.ClassMethodDesc cmd)
logback to summary
public static void log(String className, byte[] bytes)
putfieldback to summary
public static void putfield(CodeBuilder codeBuilder, ClassDesc owner, Bytecode.FieldDesc field)
throwExceptionback to summary
public static void throwException(CodeBuilder cb, ClassDesc type, String message)
unboxback to summary
public static void unbox(CodeBuilder codeBuilder, ClassDesc type)
jdk.jfr.internal.util back to summary

public final Record Bytecode.ClassMethodDesc

extends Record
Class Inheritance
Record Components
type:ClassDesc 
method:Bytecode.MethodDesc 

Field Summary

Modifier and TypeField and Description
private final Bytecode.MethodDesc
method

Record Component accessed by method().

private final ClassDesc
type

Record Component accessed by type().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public Bytecode.MethodDesc
method()

Record Component getter of method.

public static Bytecode.ClassMethodDesc
of(Class<?> clazz, String method, String desrciptor)

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public ClassDesc
type()

Record Component getter of type.

Field Detail

methodback to summary
private final Bytecode.MethodDesc method

Record Component accessed by method().

typeback to summary
private final ClassDesc type

Record Component accessed by type().

Constructor Detail

ClassMethodDescback to summary
public ClassMethodDesc(ClassDesc type, Bytecode.MethodDesc method)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

methodback to summary
public Bytecode.MethodDesc method()

Record Component getter of method.

ofback to summary
public static Bytecode.ClassMethodDesc of(Class<?> clazz, String method, String desrciptor)
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

typeback to summary
public ClassDesc type()

Record Component getter of type.

jdk.jfr.internal.util back to summary

public final Record Bytecode.FieldDesc

extends Record
Class Inheritance
Record Components
type:ClassDesc 
name:String 

Field Summary

Modifier and TypeField and Description
private final String
name

Record Component accessed by name().

private final ClassDesc
type

Record Component accessed by type().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public String
name()

Record Component getter of name.

public static Bytecode.FieldDesc
of(ClassDesc type, String name)

public static Bytecode.FieldDesc
of(Class<?> type, String name)

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public ClassDesc
type()

Record Component getter of type.

Field Detail

nameback to summary
private final String name

Record Component accessed by name().

typeback to summary
private final ClassDesc type

Record Component accessed by type().

Constructor Detail

FieldDescback to summary
public FieldDesc(ClassDesc type, String name)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

nameback to summary
public String name()

Record Component getter of name.

ofback to summary
public static Bytecode.FieldDesc of(ClassDesc type, String name)
ofback to summary
public static Bytecode.FieldDesc of(Class<?> type, String name)
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

typeback to summary
public ClassDesc type()

Record Component getter of type.

jdk.jfr.internal.util back to summary

public final Record Bytecode.MethodDesc

extends Record
Class Inheritance
Record Components
name:String 
descriptor:MethodTypeDesc 

Field Summary

Modifier and TypeField and Description
private final MethodTypeDesc
descriptor

Record Component accessed by descriptor().

private final String
name

Record Component accessed by name().

Constructor Summary

AccessConstructor and Description
public
MethodDesc(String name, MethodTypeDesc descriptor)

Method Summary

Modifier and TypeMethod and Description
public MethodTypeDesc
descriptor()

Record Component getter of descriptor.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public boolean
public String
name()

Record Component getter of name.

public static Bytecode.MethodDesc
of(String methodName, String descriptor)

public static Bytecode.MethodDesc
of(String methodName, Class<?> returnType, Class<?>... parameters)

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

descriptorback to summary
private final MethodTypeDesc descriptor

Record Component accessed by descriptor().

nameback to summary
private final String name

Record Component accessed by name().

Constructor Detail

MethodDescback to summary
public MethodDesc(String name, MethodTypeDesc descriptor)

Method Detail

descriptorback to summary
public MethodTypeDesc descriptor()

Record Component getter of descriptor.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

matchesback to summary
public boolean matches(MethodModel m)
nameback to summary
public String name()

Record Component getter of name.

ofback to summary
public static Bytecode.MethodDesc of(String methodName, String descriptor)
ofback to summary
public static Bytecode.MethodDesc of(String methodName, Class<?> returnType, Class<?>... parameters)
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

jdk.jfr.internal.util back to summary

public final Record Bytecode.SettingDesc

extends Record
Class Inheritance
Record Components
paramType:ClassDesc 
methodName:String 

Field Summary

Modifier and TypeField and Description
private final String
methodName

Record Component accessed by methodName().

private final ClassDesc
paramType

Record Component accessed by paramType().

Constructor Summary

AccessConstructor and Description
public
SettingDesc(ClassDesc paramType, String methodName)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public String
methodName()

Record Component getter of methodName.

public ClassDesc
paramType()

Record Component getter of paramType.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

methodNameback to summary
private final String methodName

Record Component accessed by methodName().

paramTypeback to summary
private final ClassDesc paramType

Record Component accessed by paramType().

Constructor Detail

SettingDescback to summary
public SettingDesc(ClassDesc paramType, String methodName)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

methodNameback to summary
public String methodName()

Record Component getter of methodName.

paramTypeback to summary
public ClassDesc paramType()

Record Component getter of paramType.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.