Top Description Methods
org.eclipse.jdt.annotation

public @Interface Owning

extends Annotation
Annotations
@Retention:CLASS
@Documented
@Target:PARAMETER, METHOD, FIELD, TYPE_USE
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target

This annotation allows to specify responsibility for certain objects as they are passed from one method to another.

Based on this annotation, flow oriented analysis tools can be made more precise without the need to perform full-system analysis, as the @Owning annotation describes a contract, consisting of two sides that can be checked independently.

The Eclipse Compiler for Java™ (version 3.37 and greater) interprets this annotation when placed on a value of type AutoCloseable or any subtype. This annotation is interpreted specifically in these locations:

Method parameter (ElementType#PARAMETER):
Here @Owning denotes that the responsibility to close a resource passed into this parameter will lie with the receiving method, on this particular flow.
Method (ElementType#METHOD) - as a way to refer to the method return value:
Here @Owning denotes that responsibility to close a resource received from a call to this method will lie with the receiving code.
Field (ElementType#FIELD)
This annotation marks that the lifecycle of a resource stored in the field is tied to the lifecycle of the enclosing object. In order to allow for precise analysis in this situation, it is recommended that the enclosing class of such a field implements AutoCloseable. In that case, it will be the responsibility of the class's close() implementation to also close all resources stored in @Owning fields.
Method receiver (via ElementType#TYPE_USE)
Annotating a method receiver (explicit this parameter) as owning signals that the method is responsible for closing all contained resources. The method will be treated as a "custom close method".
The annotation is not evaluated in any other TYPE_USE locations.

Responsibility to close a resource may initially arise from these situations:

Responsibility to close a resource may be fulfilled by ensuring any of these measures on every possible path:

Since
2.3

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString