[thread-safety] use jsr-305 versions of ThreadSafe/NotThreadSafe rather than defining custom annotations

Summary: Just cleanup; gives us slightly less test code to maintain.

Reviewed By: jeremydubreil

Differential Revision: D4429265

fbshipit-source-id: d43c308
master
Sam Blackshear 8 years ago committed by Facebook Github Bot
parent adc68c6d57
commit d39d4cfa20

@ -14,6 +14,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import javax.annotation.concurrent.ThreadSafe;
import android.support.annotation.UiThread; import android.support.annotation.UiThread;
import com.facebook.infer.annotation.ThreadConfined; import com.facebook.infer.annotation.ThreadConfined;

@ -9,6 +9,8 @@
package codetoanalyze.java.checkers; package codetoanalyze.java.checkers;
import javax.annotation.concurrent.ThreadSafe;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.MyImmutableList; import com.google.common.collect.MyImmutableList;
import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.ImmutableList.Builder;

@ -9,6 +9,8 @@
package codetoanalyze.java.checkers; package codetoanalyze.java.checkers;
import javax.annotation.concurrent.ThreadSafe;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;

@ -9,6 +9,8 @@
package codetoanalyze.java.checkers; package codetoanalyze.java.checkers;
import javax.annotation.concurrent.ThreadSafe;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;

@ -9,17 +9,7 @@
package codetoanalyze.java.checkers; package codetoanalyze.java.checkers;
import java.lang.annotation.Documented; import javax.annotation.concurrent.NotThreadSafe;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
@interface NotThreadSafe {
}
@NotThreadSafe @NotThreadSafe
public class NotThreadSafeExample{ public class NotThreadSafeExample{

@ -9,6 +9,8 @@
package codetoanalyze.java.checkers; package codetoanalyze.java.checkers;
import javax.annotation.concurrent.ThreadSafe;
class Obj { class Obj {
Object f; Object f;
Obj g; Obj g;

@ -1,22 +0,0 @@
/*
* Copyright (c) 2016 - 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 codetoanalyze.java.checkers;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface ThreadSafe {
}

@ -9,6 +9,9 @@
package codetoanalyze.java.checkers; package codetoanalyze.java.checkers;
import javax.annotation.concurrent.NotThreadSafe;
import javax.annotation.concurrent.ThreadSafe;
import com.facebook.infer.annotation.ThreadSafeMethod; import com.facebook.infer.annotation.ThreadSafeMethod;
@ThreadSafe @ThreadSafe

Loading…
Cancel
Save