final class Method extends JVMMethod
A method belonging to a class file. Method objects are created by creating a class file using MethodTemplates.
- Alphabetic
- By Inheritance
- Method
- JVMMethod
- InstructionsContainer
- Ordered
- Comparable
- ClassMember
- ConcreteSourceElement
- SourceElement
- CommonSourceElementAttributes
- CommonAttributes
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
<(that: JVMMethod): Boolean
- Definition Classes
- Ordered
-
def
<=(that: JVMMethod): Boolean
- Definition Classes
- Ordered
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
>(that: JVMMethod): Boolean
- Definition Classes
- Ordered
-
def
>=(that: JVMMethod): Boolean
- Definition Classes
- Ordered
-
val
accessFlags: Int
The access flags of this method.
The access flags of this method. Though it is possible to directly work with the
accessFlagsfield, it may be more convenient to use the respective methods (isNative,isAbstract, ...) to query the access flags.- Definition Classes
- Method → JVMMethod → ConcreteSourceElement
-
def
actualArgumentsCount: Int
The number of explicit and implicit parameters of this method – that is, including
thisin case of a non-static method.The number of explicit and implicit parameters of this method – that is, including
thisin case of a non-static method.- Definition Classes
- JVMMethod
-
def
annotationDefault: Option[ElementValue]
If this method represents a method of an annotation that defines a default value then this value is returned.
If this method represents a method of an annotation that defines a default value then this value is returned.
- Definition Classes
- JVMMethod
-
def
annotations: Annotations
The list of all annotations.
The list of all annotations. In general, if a specific annotation is searched for the method runtimeVisibleAnnotations or runtimeInvisibleAnnotations should be used.
- Definition Classes
- CommonSourceElementAttributes
-
def
asClassFile: ClassFile
- Definition Classes
- SourceElement
-
def
asField: Field
- Definition Classes
- SourceElement
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asMethod: Method.this.type
- Definition Classes
- Method → SourceElement
-
def
asVirtualMethod(declaringClassType: ObjectType): VirtualMethod
This method as a virtual method belonging to the given declaring class type.
-
def
asVirtualMethod: VirtualMethod
- returns
This method as a VirtualMethod.
-
val
attributes: Attributes
This method's defined attributes.
This method's defined attributes. (Which attributes are available generally depends on the configuration of the class file reader. However, the
Code_Attributeis – if it was loaded – always directly accessible by means of thebodyattribute.)- Definition Classes
- Method → JVMMethod → CommonAttributes
-
val
body: Option[Code]
The body of the method if any.
-
def
classFile: ClassFile
This method's class file.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
compare(otherName: String, otherDescriptor: MethodDescriptor): Int
- Definition Classes
- JVMMethod
-
def
compare(other: JVMMethod): Int
Defines an absolute order on
Methodinstances based on their method signatures.Defines an absolute order on
Methodinstances based on their method signatures.The order is defined by lexicographically comparing the names of the methods and – in case that the names of both methods are identical – by comparing their method descriptors.
- Definition Classes
- JVMMethod → Ordered
-
def
compareAttributes(other: Attributes, config: SimilarityTestConfiguration): Option[AnyRef]
Compares this element's attributes with the given one.
Compares this element's attributes with the given one.
- returns
None, if both attribute lists are similar; Some(<description of the difference>) otherwise.
- Attributes
- protected[this]
- Definition Classes
- CommonAttributes
-
def
compareTo(that: JVMMethod): Int
- Definition Classes
- Ordered → Comparable
-
def
copy(accessFlags: Int = this.accessFlags, name: String = this.name, descriptor: MethodDescriptor = this.descriptor, body: Option[Code] = this.body, attributes: Attributes = this.attributes): MethodTemplate
Creates a copy of this method object which is not associated with any class file.
Creates a copy of this method object which is not associated with any class file.
- Definition Classes
- JVMMethod
-
val
descriptor: MethodDescriptor
This method's descriptor.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exceptionTable: Option[ExceptionTable]
- Definition Classes
- JVMMethod
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
foreachTypeAnnotation[U](f: (TypeAnnotation) ⇒ U): Unit
- Definition Classes
- CommonAttributes
-
def
fullyQualifiedSignature: String
The fully qualified signature of this method.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
hasDefaultVisibility: Boolean
- Definition Classes
- ClassMember
-
def
hasFlags(accessFlags: Int): Boolean
- Definition Classes
- ConcreteSourceElement
-
def
hasSignature(name: String, descriptor: MethodDescriptor): Boolean
Returns
trueif this method has the given name and descriptor.Returns
trueif this method has the given name and descriptor.- Definition Classes
- JVMMethod
- Note
When matching the descriptor the return type is also taken into consideration.
-
def
hasSignature(other: Method, ignoreReturnType: Boolean = false): Boolean
Returns
trueif this method and the given method have the same signature.Returns
trueif this method and the given method have the same signature.- ignoreReturnType
If
false(default), then the return type is taken into consideration. This models the behavior of the JVM w.r.t. method dispatch. However, if you want to determine whether this method potentially overrides the given one, you may want to specify that you want to ignore the return type. (The Java compiler generates the appropriate methods.)
- Definition Classes
- JVMMethod
-
def
hasSignature(name: String, descriptor: MethodDescriptor, ignoreReturnType: Boolean): Boolean
Returns
trueif this method has the given name and descriptor.Returns
trueif this method has the given name and descriptor.- ignoreReturnType
If
false, then the return type is taken into consideration; this models the behavior of the JVM w.r.t. method dispatch.
- Definition Classes
- JVMMethod
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
instructionsOption: Option[Array[Instruction]]
- Definition Classes
- JVMMethod → InstructionsContainer
-
final
def
isAbstract: Boolean
- Definition Classes
- JVMMethod
-
final
def
isBridge: Boolean
- Definition Classes
- JVMMethod
-
def
isClass: Boolean
- Definition Classes
- SourceElement
-
final
def
isConstructor: Boolean
- Definition Classes
- JVMMethod
-
def
isDeprecated: Boolean
Returns true if this (field, method, class) declaration is declared as deprecated.
Returns true if this (field, method, class) declaration is declared as deprecated.
Note
The deprecated attribute is always set by the Java compiler when either the deprecated annotation or the JavaDoc tag is used.
- Definition Classes
- CommonSourceElementAttributes
-
def
isField: Boolean
- Definition Classes
- SourceElement
-
final
def
isFinal: Boolean
- Definition Classes
- ClassMember
-
final
def
isInitializer: Boolean
- Definition Classes
- JVMMethod
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isMandatedParameter(parameterIndex: Int): Answer
Returns
Yesif the parameter with the given index is mandated;Noif not andUnknownif the information is not available.Returns
Yesif the parameter with the given index is mandated;Noif not andUnknownif the information is not available. The indexes correspond to those used by the MethodDescriptor.- Definition Classes
- JVMMethod
-
def
isMethod: Boolean
- Definition Classes
- Method → SourceElement
-
final
def
isNative: Boolean
- Definition Classes
- JVMMethod
-
final
def
isNativeAndVarargs: Boolean
- Definition Classes
- JVMMethod
-
final
def
isNotAbstract: Boolean
- Definition Classes
- JVMMethod
-
final
def
isNotFinal: Boolean
- Definition Classes
- ClassMember
-
final
def
isNotStatic: Boolean
- Definition Classes
- ClassMember
-
final
def
isPackagePrivate: Boolean
- Definition Classes
- ClassMember
-
final
def
isPrivate: Boolean
- Definition Classes
- ClassMember
-
final
def
isProtected: Boolean
- Definition Classes
- ClassMember
-
final
def
isPublic: Boolean
- Definition Classes
- ClassMember
-
final
def
isStatic: Boolean
- Definition Classes
- ClassMember
-
final
def
isStaticInitializer: Boolean
- Definition Classes
- JVMMethod
-
final
def
isStrict: Boolean
- Definition Classes
- JVMMethod
-
final
def
isSynchronized: Boolean
- Definition Classes
- JVMMethod
-
final
def
isSynthetic: Boolean
Trueif theSyntheticaccess flag or attribute is used.Trueif theSyntheticaccess flag or attribute is used.- Definition Classes
- ClassMember → CommonSourceElementAttributes
-
def
isSyntheticParameter(parameterIndex: Int): Answer
Returns
Yesif the parameter with the given index is synthetic;Noif not andUnknownif the information is not available.Returns
Yesif the parameter with the given index is synthetic;Noif not andUnknownif the information is not available. The indexes correspond to those used by the MethodDescriptor.- Definition Classes
- JVMMethod
-
final
def
isVarargs: Boolean
- Definition Classes
- JVMMethod
-
def
isVirtual: Boolean
- Definition Classes
- SourceElement
-
final
def
isVirtualCallTarget: Boolean
Returns true if this method is a potential target of a virtual call by means of an invokevirtual or invokeinterface instruction; i.e., if the method is not an initializer, is not abstract, is not private and is not static.
Returns true if this method is a potential target of a virtual call by means of an invokevirtual or invokeinterface instruction; i.e., if the method is not an initializer, is not abstract, is not private and is not static.
- Definition Classes
- JVMMethod
-
final
def
isVirtualMethodDeclaration: Boolean
Returns true if this method declares a virtual method.
Returns true if this method declares a virtual method. This method may be abstract!
- Definition Classes
- JVMMethod
-
def
methodParameters: Option[MethodParameterTable]
If this method has extended method parameter information, the
MethodParameterTableis returned.If this method has extended method parameter information, the
MethodParameterTableis returned.- Definition Classes
- JVMMethod
-
def
methodTypeSignature: Option[MethodTypeSignature]
Each method optionally defines a method type signature.
Each method optionally defines a method type signature.
- Definition Classes
- JVMMethod
-
val
name: String
The name of the method.
The name of the method. The name is interned (see
String.intern()for details) to enable reference comparisons.- Definition Classes
- Method → JVMMethod → ClassMember
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
parameterAnnotations: Iterator[Annotations]
- Definition Classes
- JVMMethod
-
def
parameterTypes: FieldTypes
- Definition Classes
- JVMMethod
-
def
requiredRegisters: Int
The number of registers required to store this method's parameters ( including the self reference if necessary).
The number of registers required to store this method's parameters ( including the self reference if necessary).
Basically,
MethodDescriptor.requiredRegistersadapted by the required parameter forthisin case of an instance method.- Definition Classes
- JVMMethod
-
def
returnType: Type
- Definition Classes
- JVMMethod
-
def
runtimeInvisibleAnnotations: Annotations
- Definition Classes
- CommonSourceElementAttributes
-
def
runtimeInvisibleParameterAnnotations: ParameterAnnotations
- Definition Classes
- JVMMethod
-
def
runtimeInvisibleTypeAnnotations: TypeAnnotations
- Definition Classes
- CommonAttributes
-
def
runtimeVisibleAnnotations: Annotations
- Definition Classes
- CommonSourceElementAttributes
-
def
runtimeVisibleParameterAnnotations: ParameterAnnotations
- Definition Classes
- JVMMethod
-
def
runtimeVisibleTypeAnnotations: TypeAnnotations
- Definition Classes
- CommonAttributes
-
def
signature: MethodSignature
- Definition Classes
- JVMMethod
-
def
signatureToJava(withVisibility: Boolean = true): String
- Definition Classes
- JVMMethod
-
def
similar(other: JVMMethod, config: SimilarityTestConfiguration): Boolean
Compares this method with the given one for structural equality.
Compares this method with the given one for structural equality. The declaring class file is ignored.
Two methods are structurally equal if they have the same names, flags and descriptor. The bodies and attributes are recursively checked for structural equality. In case of the attributes, the order doesn't matter!
- Definition Classes
- JVMMethod
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toJava(methodInfo: String): String
A Java-like representation of the signature of this method; "the body" will contain the given
methodInfodata. - def toJava: String
-
def
toString(): String
- Definition Classes
- JVMMethod → AnyRef → Any
-
def
visibilityModifier: Option[VisibilityModifier]
- Definition Classes
- ConcreteSourceElement
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )