@Documented @Retention(value=RUNTIME) @Target(value={PARAMETER,CONSTRUCTOR,METHOD,TYPE_USE}) public @interface MustCallAlias
This annotation is useful for wrapper objects. For example, consider the declaration of java.net.Socket#getOutputStream:
@MustCall("close")
class Socket {
@MustCallAlias OutputStream getOutputStream(@MustCallAlias Socket this) { ... }
}
Calling close() on the returned OutputStream will close the underlying socket,
but the Socket may also be closed directly, which has the same effect.
@MustCallAlias annotations@MustCallAlias is written on the type of formal parameter p.
For a constructor:
f of the new object.
f must be annotated @Owning.
@MustCallAlias
return types, and this method's @MustCallAlias parameter must be passed in the
MustCallAlias position to that method or constructor (i.e., the calls must pass
@MustCallAlias parameter through a chain of @MustCallAlias-annotated
parameters and returns).
PolyMustCall.