[thread-safety] Add @ReturnsOwnership annotation for methods and handle it in the thread-safety analysis
Reviewed By: jeremydubreil Differential Revision: D4538654 fbshipit-source-id: e5889acmaster
parent
096ee4e2a8
commit
b229b39a1b
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.infer.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Tell the thread-safety analysis that this method transfers ownership of its return value to its
|
||||
* caller. Ownership means that the caller is allowed to both read and write the value outside of
|
||||
* synchronization. The annotated method should not retain any references to the value.
|
||||
* This annotation is trusted for now, but may be checked eventually.
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface ReturnsOwnership {
|
||||
}
|
Loading…
Reference in new issue