Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy-to-use performance and memory .NET profiler for Windows, Linux and macOS.
Secure and easy profiling in cloud, containers and clustered environments.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Callback method parameter annotation @ReturnValue

Callback parameter annotated with @ReturnValue provides the instrumented method's return value.

In which callbacks can be used

Parameter annotated with @ReturnValue can be used in onReturn() only.

Declaration type

Parameter annotated with @ReturnValue can be declared as a reference type or as a primitive type.

If the callback parameter is declared as java.lang.Object, it will be assigned with object reference as is if the actual parameter type is a reference type, or with a boxed value if the actual parameter type is primitive.

If the callback parameter is declared as some reference type other than java.lang.Object, it will be assigned with the actual method parameter value only if it is declared as strictly the same type. Otherwise the callback parameter value will be null.

If the callback parameter is declared as a primitive type, it will be assigned with the actual method parameter value only if it is declared as strictly the same type. Otherwise it will be assigned with 0; no type conversions will be performed. For example, int will not be cast to long.

Type of callback parameter annotated with @ReturnValue Actual instrumented method return value type Resulting value of the callback parameter
java.lang.Object any reference type the value as is
any primitive type a boxed value
void null
some reference type T1 other than java.lang.Object same reference type T1 the value as is
any reference or primitive type T2 != T1 null
void null
some primitive type T1 same primitive type T1 the value as is
any reference or primitive type T2 != T1 0
void 0

Note: The type matching rules for @ReturnValue are similar to ones for @Param and differ from the rules for @This

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.