Parameters that are annotated with this annotation will be assigned by also considering the runtime type of the
target parameter. The same is true for a method's return type if a target method is annotated with this annotation.
For example, if a source method
foo(Object)
is attempted to be bound to
bar(@RuntimeType String)
, the binding will attempt to cast the argument of
foo
to a
String
type before calling
bar
with this argument. If this is not possible, a
ClassCastException
will be thrown at runtime. Similarly, if a method
foo
returns a type
String
but is bound to a method
that returns a type
Object
, annotating the target method with
@RuntimeType
results in the
foo
method casting the target's method return value to
String
before returning a value itself.