sealed abstract class JVMMethod extends ClassMember with Ordered[JVMMethod] with InstructionsContainer
Represents a single method.
Method objects are constructed using the companion object's factory methods.
- Source
- Method.scala
- Note
Methods, which are directly created, have no link to "their defining" ClassFile. This link is implicitly established when a method is added to a ClassFile. This operation also updates the method object. Hence, an empty method/constructor which is identical across multiple classes can be reused.
,Equality of methods is – by purpose – reference based.
- Alphabetic
- By Inheritance
- JVMMethod
- InstructionsContainer
- Ordered
- Comparable
- ClassMember
- ConcreteSourceElement
- SourceElement
- CommonSourceElementAttributes
- CommonAttributes
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
accessFlags: Int
The access flags of this method.
The access flags of this method. Though it is possible to directly work with the
accessFlags
field, it may be more convenient to use the respective methods (isNative
,isAbstract
, ...) to query the access flags.- Definition Classes
- JVMMethod → ConcreteSourceElement
-
abstract
def
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_Attribute
is – if it was loaded – always directly accessible by means of thebody
attribute.)- Definition Classes
- JVMMethod → CommonAttributes
-
abstract
def
body: Option[Code]
The body of the method if any.
-
abstract
def
descriptor: MethodDescriptor
This method's descriptor.
-
abstract
def
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
- JVMMethod → ClassMember
Concrete 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
-
def
actualArgumentsCount: Int
The number of explicit and implicit parameters of this method – that is, including
this
in case of a non-static method. -
def
annotationDefault: Option[ElementValue]
If this method represents a method of an annotation that defines a default value then this value is returned.
-
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
- Definition Classes
- SourceElement
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
- def compare(otherName: String, otherDescriptor: MethodDescriptor): Int
-
def
compare(other: JVMMethod): Int
Defines an absolute order on
Method
instances based on their method signatures.Defines an absolute order on
Method
instances 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.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def exceptionTable: Option[ExceptionTable]
-
final
def
foreachTypeAnnotation[U](f: (TypeAnnotation) ⇒ U): Unit
- Definition Classes
- CommonAttributes
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
hasDefaultVisibility: Boolean
- Definition Classes
- ClassMember
-
def
hasFlags(accessFlags: Int): Boolean
- Definition Classes
- ConcreteSourceElement
-
def
hasSignature(name: String, descriptor: MethodDescriptor): Boolean
Returns
true
if this method has the given name and descriptor.Returns
true
if this method has the given name and descriptor.- Note
When matching the descriptor the return type is also taken into consideration.
-
def
hasSignature(other: Method, ignoreReturnType: Boolean = false): Boolean
Returns
true
if this method and the given method have the same signature.Returns
true
if 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.)
-
def
hasSignature(name: String, descriptor: MethodDescriptor, ignoreReturnType: Boolean): Boolean
Returns
true
if this method has the given name and descriptor.Returns
true
if 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.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
instructionsOption: Option[Array[Instruction]]
- Definition Classes
- JVMMethod → InstructionsContainer
- final def isAbstract: Boolean
- final def isBridge: Boolean
-
def
isClass: Boolean
- Definition Classes
- SourceElement
- final def isConstructor: Boolean
-
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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isMandatedParameter(parameterIndex: Int): Answer
Returns
Yes
if the parameter with the given index is mandated;No
if not andUnknown
if the information is not available.Returns
Yes
if the parameter with the given index is mandated;No
if not andUnknown
if the information is not available. The indexes correspond to those used by the MethodDescriptor. -
def
isMethod: Boolean
- Definition Classes
- SourceElement
- final def isNative: Boolean
- final def isNativeAndVarargs: Boolean
- final def isNotAbstract: Boolean
-
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
- final def isStrict: Boolean
- final def isSynchronized: Boolean
-
final
def
isSynthetic: Boolean
True
if theSynthetic
access flag or attribute is used.True
if theSynthetic
access flag or attribute is used.- Definition Classes
- ClassMember → CommonSourceElementAttributes
-
def
isSyntheticParameter(parameterIndex: Int): Answer
Returns
Yes
if the parameter with the given index is synthetic;No
if not andUnknown
if the information is not available.Returns
Yes
if the parameter with the given index is synthetic;No
if not andUnknown
if the information is not available. The indexes correspond to those used by the MethodDescriptor. - final def isVarargs: Boolean
-
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.
-
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!
-
def
methodParameters: Option[MethodParameterTable]
If this method has extended method parameter information, the
MethodParameterTable
is returned. -
def
methodTypeSignature: Option[MethodTypeSignature]
Each method optionally defines a method type signature.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def parameterAnnotations: Iterator[Annotations]
- def parameterTypes: FieldTypes
-
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.requiredRegisters
adapted by the required parameter forthis
in case of an instance method. - def returnType: Type
-
def
runtimeInvisibleAnnotations: Annotations
- Definition Classes
- CommonSourceElementAttributes
- def runtimeInvisibleParameterAnnotations: ParameterAnnotations
-
def
runtimeInvisibleTypeAnnotations: TypeAnnotations
- Definition Classes
- CommonAttributes
-
def
runtimeVisibleAnnotations: Annotations
- Definition Classes
- CommonSourceElementAttributes
- def runtimeVisibleParameterAnnotations: ParameterAnnotations
-
def
runtimeVisibleTypeAnnotations: TypeAnnotations
- Definition Classes
- CommonAttributes
- def signature: MethodSignature
- def signatureToJava(withVisibility: Boolean = true): String
-
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!
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- JVMMethod → AnyRef → Any
-
def
visibilityModifier: Option[VisibilityModifier]
- Definition Classes
- ConcreteSourceElement
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated