|
|
|
@ -23,11 +23,31 @@ import com.facebook.infer.annotation.ThreadConfined;
|
|
|
|
|
|
|
|
|
|
/** tests for classes and method annotations that are meaningful w.r.t thread-safety */
|
|
|
|
|
|
|
|
|
|
@Target(ElementType.METHOD)
|
|
|
|
|
@Retention(RetentionPolicy.CLASS)
|
|
|
|
|
@interface OnBind {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Target(ElementType.METHOD)
|
|
|
|
|
@Retention(RetentionPolicy.CLASS)
|
|
|
|
|
@interface OnEvent {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Target(ElementType.METHOD)
|
|
|
|
|
@Retention(RetentionPolicy.CLASS)
|
|
|
|
|
@interface OnMount {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Target(ElementType.METHOD)
|
|
|
|
|
@Retention(RetentionPolicy.CLASS)
|
|
|
|
|
@interface OnUnbind {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Target(ElementType.METHOD)
|
|
|
|
|
@Retention(RetentionPolicy.CLASS)
|
|
|
|
|
@interface OnUnmount {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ThreadSafe
|
|
|
|
|
class Annotations {
|
|
|
|
|
Object f;
|
|
|
|
@ -89,6 +109,26 @@ class Annotations {
|
|
|
|
|
this.f = new Object();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@OnBind
|
|
|
|
|
public void onBindMethodOk() {
|
|
|
|
|
this.f = new Object();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@OnMount
|
|
|
|
|
public void onMountMethodOk() {
|
|
|
|
|
this.f = new Object();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@OnUnmount
|
|
|
|
|
public void onUnmountMethodOk() {
|
|
|
|
|
this.f = new Object();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@OnUnbind
|
|
|
|
|
public void onUnbindMethodOk() {
|
|
|
|
|
this.f = new Object();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AssumeThreadSafe(because = "it's a test")
|
|
|
|
|
public void assumeThreadSafeOk() {
|
|
|
|
|
this.f = new Object();
|
|
|
|
|