public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersProvider
constant pools
.ANNOTATION, BRIDGE, ENUM, MANDATED, SYNTHETIC, VARARGS
Modifier and Type | Method and Description |
---|---|
StackTraceElement |
asStackTraceElement(int bci)
Returns a stack trace element for this method and a given bytecode index.
|
boolean |
canBeInlined()
Returns
true if this method is not excluded from inlining and has associated Java
bytecodes (@see hasBytecodes() ). |
boolean |
canBeStaticallyBound()
Checks whether this method can be statically bound (usually, that means it is final or
private or static, but not abstract, or the declaring class is final).
|
<T extends Annotation> |
getAnnotation(Class<T> annotationClass)
Returns the annotation for the specified type of this method, if such an annotation is
present.
|
Annotation[] |
getAnnotations()
Returns all annotations of this method.
|
byte[] |
getCode()
Returns the bytecode of this method, if the method has code.
|
int |
getCodeSize()
Returns the size of the bytecode of this method, if the method has code.
|
ConstantPool |
getConstantPool()
Returns the constant pool of this method.
|
ResolvedJavaType |
getDeclaringClass()
Returns the
ResolvedJavaType object representing the class or interface that declares
this method. |
Constant |
getEncoding()
Gets the encoding of (that is, a constant representing the value of) this method.
|
ExceptionHandler[] |
getExceptionHandlers()
Returns the list of exception handlers for this method.
|
Type[] |
getGenericParameterTypes()
Returns an array of
Type objects that represent the formal parameter types, in
declaration order, of this method. |
LineNumberTable |
getLineNumberTable()
Returns the LineNumberTable of this method or null if this method does not have a line
numbers table.
|
LocalVariableTable |
getLocalVariableTable()
Returns the local variable table of this method or null if this method does not have a local
variable table.
|
int |
getMaxLocals()
Returns the maximum number of locals used in this method's bytecodes.
|
int |
getMaxStackSize()
Returns the maximum number of stack slots used in this method's bytecodes.
|
int |
getModifiers()
Returns the Java Virtual Machine modifiers for this element.
|
default <T extends Annotation> |
getParameterAnnotation(Class<T> annotationClass,
int parameterIndex)
Gets the annotation of a particular type for a formal parameter of this method.
|
Annotation[][] |
getParameterAnnotations()
Returns an array of arrays that represent the annotations on the formal parameters, in
declaration order, of this method.
|
default <T extends Annotation> |
getParameterAnnotations(Class<T> annotationClass)
Gets the annotations of a particular type for the formal parameters of this method.
|
default ProfilingInfo |
getProfilingInfo()
Returns an object that provides access to the profiling information recorded for this method.
|
ProfilingInfo |
getProfilingInfo(boolean includeNormal,
boolean includeOSR)
Returns an object that provides access to the profiling information recorded for this method.
|
SpeculationLog |
getSpeculationLog() |
default boolean |
hasBytecodes()
Checks whether the method has bytecodes associated with it.
|
default boolean |
hasReceiver()
Checks whether the method has a receiver parameter - i.e., whether it is not static.
|
JavaConstant |
invoke(JavaConstant receiver,
JavaConstant[] arguments)
Invokes the underlying method represented by this object, on the specified object with the
specified parameters.
|
default boolean |
isBridge()
Checks that the method is a bridge
method.
|
boolean |
isClassInitializer()
Checks whether this method is a class initializer.
|
boolean |
isConstructor()
Checks whether this method is a constructor.
|
boolean |
isDefault()
Returns
true if this method is a default method; returns false otherwise. |
default boolean |
isFinal() |
boolean |
isInVirtualMethodTable(ResolvedJavaType resolved)
Checks if this method is present in the virtual table for subtypes of the specified
type.
|
default boolean |
isJavaLangObjectInit()
Determines if this method is
Object.Object() . |
static boolean |
isSignaturePolymorphic(JavaType holder,
String name,
MetaAccessProvider metaAccess)
Determines if the method identified by its holder and name is a signature
polymorphic method.
|
default boolean |
isSynthetic()
Determines if this method is a synthetic method as defined by the Java Language
Specification.
|
default boolean |
isVarArgs()
Checks that the method is a varargs
method.
|
void |
reprofile()
Invalidates the profiling information and restarts profiling upon the next invocation.
|
boolean |
shouldBeInlined()
Returns
true if the inlining of this method should be forced. |
default JavaType[] |
toParameterTypes() |
format, getName, getSignature
isAbstract, isConcrete, isFinalFlagSet, isInterface, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, jvmClassModifiers, jvmFieldModifiers, jvmMethodModifiers
byte[] getCode()
holder
is not linked
.
The contained constant pool indices may not be the ones found in the original class file but
they can be used with the JVMCI API (e.g. methods in ConstantPool
).null
if getCodeSize() == 0
or if the
code is not ready.int getCodeSize()
getCode()
. length
if the method has code.ResolvedJavaType getDeclaringClass()
ResolvedJavaType
object representing the class or interface that declares
this method.getDeclaringClass
in interface JavaMethod
int getMaxLocals()
int getMaxStackSize()
int getModifiers()
ResolvedJavaType
) can not be private or protected.
Only the method flags specified in the JVM specification will be included in the returned mask.
getModifiers
in interface ModifiersProvider
default boolean isFinal()
default boolean isSynthetic()
default boolean isVarArgs()
default boolean isBridge()
boolean isDefault()
true
if this method is a default method; returns false
otherwise.
A default method is a public non-abstract instance method, that is, a non-static method with
a body, declared in an interface type.boolean isClassInitializer()
true
if the method is a class initializerboolean isConstructor()
true
if the method is a constructorboolean canBeStaticallyBound()
true
if this method can be statically boundExceptionHandler[] getExceptionHandlers()
StackTraceElement asStackTraceElement(int bci)
default ProfilingInfo getProfilingInfo()
ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR)
includeNormal
- if true,
deoptimization counts will include deoptimization that happened during execution
of standard non-osr methods.includeOSR
- if true,
deoptimization counts will include deoptimization that happened during execution
of on-stack-replacement methods.void reprofile()
ConstantPool getConstantPool()
Annotation[] getAnnotations()
<T extends Annotation> T getAnnotation(Class<T> annotationClass)
annotationClass
- the Class object corresponding to the annotation typenull
Annotation[][] getParameterAnnotations()
Method.getParameterAnnotations()
Type[] getGenericParameterTypes()
Type
objects that represent the formal parameter types, in
declaration order, of this method.Method.getGenericParameterTypes()
boolean canBeInlined()
true
if this method is not excluded from inlining and has associated Java
bytecodes (@see hasBytecodes()
).boolean shouldBeInlined()
true
if the inlining of this method should be forced.LineNumberTable getLineNumberTable()
LocalVariableTable getLocalVariableTable()
JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments)
Method.invoke(java.lang.Object, java.lang.Object...)
.receiver
- The receiver for the invocation, or null
if it is a static method.arguments
- The arguments for the invocation.null
if the return type is
void
.Constant getEncoding()
boolean isInVirtualMethodTable(ResolvedJavaType resolved)
default <T extends Annotation> T getParameterAnnotation(Class<T> annotationClass, int parameterIndex)
annotationClass
- the Class object corresponding to the annotation typeparameterIndex
- the index of a formal parameter of method
annotationClass
for the formal parameter present, else
nullIndexOutOfBoundsException
- if parameterIndex
does not denote a formal
parameterdefault JavaType[] toParameterTypes()
default <T extends Annotation> T[] getParameterAnnotations(Class<T> annotationClass)
annotationClass
- the Class object corresponding to the annotation typeannotationClass
(if any) for each formal parameter
presentdefault boolean hasBytecodes()
default boolean hasReceiver()
default boolean isJavaLangObjectInit()
Object.Object()
.SpeculationLog getSpeculationLog()
static boolean isSignaturePolymorphic(JavaType holder, String name, MetaAccessProvider metaAccess)