ReplaceWith


@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.FIELD, AnnotationTarget.CONSTRUCTOR])
public annotation ReplaceWith


Specifies a code fragment that can be used to suggest a replacement for a method in conjunction with the ReplaceWith lint check.

The expression parameter specified the replacement expression, which is interpreted in the context of the symbol being used and can reference members of the enclosing classes, etc.

For method calls, the replacement expression may contain parameter names of the method being replaced, which will be substituted with actual arguments used in the call being replaced:

@ReplaceWith(expression = "event.getActionType(slot)")
static int getActionType(AccessibilityEvent event, int slot) { ... }

Summary

Public constructors

ReplaceWith(@NonNull String expression, @NonNull String imports)

Public methods

final @NonNull String
final @NonNull String[]

Public constructors

ReplaceWith

public ReplaceWith(@NonNull String expression, @NonNull String imports)

Public methods

getExpression

public final @NonNull String getExpression()

getImports

public final @NonNull String[] getImports()