UsesReflectionToAccessMethod



The annotated code uses reflection to indirectly access a method of the specified class/interface, or its subclasses / interface implementers.

This annotation indicates to optimizers or shrinkers that the target method should be preserved if the annotated code is reachable in the final application build.

Summary

Public constructors

UsesReflectionToAccessMethod(
    classConstant: KClass<*>,
    className: String,
    methodName: String,
    parameterTypes: Array<KClass<*>>,
    parameterTypeNames: Array<String>,
    returnType: KClass<*>,
    returnTypeName: String
)
Cmn

Public properties

KClass<*>

Class containing the method accessed by reflection.

Cmn
String

Class name (or class name pattern) containing the method accessed by reflection.

Cmn
String

Name (or name pattern) of method accessed by reflection.

Cmn
Array<String>

Defines which method to keep by specifying set of parameter classes passed.

Cmn
Array<KClass<*>>

Defines which method to keep by specifying set of parameter classes passed.

Cmn
KClass<*>

Return type of the method accessed by reflection.

Cmn
String

Return type (or type pattern) of the method accessed by reflection.

Cmn

Public constructors

UsesReflectionToAccessMethod

UsesReflectionToAccessMethod(
    classConstant: KClass<*> = Unspecified::class,
    className: String = "",
    methodName: String,
    parameterTypes: Array<KClass<*>> = [Unspecified::class],
    parameterTypeNames: Array<String> = [""],
    returnType: KClass<*> = Unspecified::class,
    returnTypeName: String = ""
)

Public properties

classConstant

val classConstant: KClass<*>

Class containing the method accessed by reflection.

Mutually exclusive with className.

className

val className: String

Class name (or class name pattern) containing the method accessed by reflection.

Mutually exclusive with classConstant.

methodName

val methodName: String

Name (or name pattern) of method accessed by reflection.

parameterTypeNames

val parameterTypeNames: Array<String>

Defines which method to keep by specifying set of parameter classes passed.

If neither parameterTypes nor parameterTypeNames is specified then methods with all parameter lists are kept.

Mutually exclusive with parameterTypes.

parameterTypes

val parameterTypes: Array<KClass<*>>

Defines which method to keep by specifying set of parameter classes passed.

If neither parameterTypes nor parameterTypeNames is specified then methods with all parameter lists are kept.

Mutually exclusive with parameterTypeNames.

returnType

val returnType: KClass<*>

Return type of the method accessed by reflection.

Ignored if not specified.

Mutually exclusive with returnTypeName.

returnTypeName

val returnTypeName: String

Return type (or type pattern) of the method accessed by reflection.

Ignored if not specified.

Mutually exclusive with returnType.