Annotation Interface Owning
This annotation is a declaration annotation rather than a type annotation, because it does not logically belong to any type hierarchy. Logically, it is a directive to the Resource Leak Checker that informs it whether it is necessary to check that a value's must-call obligations have been satisfied. In that way, it can be viewed as an annotation expressing an aliasing relationship: passing a object with a non-empty must-call obligation to a method with an owning parameter resolves that object's must-call obligation, because the ownership annotation expresses that the object at the call site and the parameter in the method's body are aliases, and so checking only one of the two is required.
Constructor results are always @Owning
. Method return types are @Owning
by
default. Formal parameters and fields are NotOwning
by default.
When the -AnoLightweightOwnership
command-line argument is passed to the checker, this
annotation and NotOwning
are ignored.
- See the Checker Framework Manual:
- Resource Leak Checker