@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public static @interface Advice.OnMethodExit
Indicates that this method should be executed before exiting the instrumented method. Any class must declare at most one method with this annotation. The annotated method must be static.
By default, the annotated method is not invoked if the instrumented method terminates exceptionally. This behavior
can be changed by setting the
onThrowable() property to an exception type for which this advice
method should be invoked. By setting the value to
Throwable, the advice method is always invoked.
|Modifier and Type||Optional Element and Description|
Determines if the annotated method should be inlined into the instrumented method or invoked from it.
Determines if the execution of the instrumented method should be repeated.
Indicates that this advice should suppress any
public abstract Class<?> repeatOn
Determines if the execution of the instrumented method should be repeated. This does not include any enter advice.
When specifying a non-primitive type, this method's return value that is subject to an
instanceof check where
the instrumented method is only executed, if the returned instance is
not an instance of the specified class.
Alternatively, it is possible to specify either
Advice.OnNonDefaultValue where the instrumented
method is only repeated if the advice method returns a default or non-default value of the advice method's return type.
It is illegal to specify a primitive type as an argument whereas setting the value to
void indicates that the
instrumented method should never be repeated.
Important: Constructors cannot be repeated.
voidif the instrumented method should never be repeated.
Throwablesuper type for which this exit advice is invoked if it was thrown from the instrumented method. If an exception is thrown, it is available via the
Advice.Thrownparameter annotation. If a method returns exceptionally, any parameter annotated with
Advice.Returnis assigned the parameter type's default value.
Throwablefor which this exit advice handler is invoked.
public abstract boolean backupArguments
true, all arguments of the instrumented method are copied before execution. Doing so, parameter reassignments applied
by the instrumented are not effective during the execution of the annotated exit advice.
Disabling this option can cause problems with the translation of stack map frames (meta data that is embedded in a Java class) if these
frames become inconsistent with the original arguments of the instrumented method. In this case, the original arguments are no longer
available to the exit advice such that Byte Buddy must abort the instrumentation with an error. If the instrumented method does not issue
a stack map frame due to a lack of branching instructions, Byte Buddy might not be able to discover such an inconsistency what can cause
VerifyError instead of a Byte Buddy-issued exception as those inconsistencies are not discovered.
trueif a backup of all method arguments should be made.
public abstract boolean inline
trueif the annotated method should be inlined into the instrumented method.
Throwabletype being thrown during the advice's execution. By default, any such exception is silently suppressed. Custom behavior can be configured by using
Copyright © 2014–2019. All rights reserved.