From 9246d1357c9576aa190e15b38da9e1587f3d7d72 Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Fri, 21 Jul 2017 12:23:46 -0700 Subject: [PATCH] [thread-safety] temporarily disable non-threadsafe interface checks Reviewed By: jeremydubreil Differential Revision: D5472633 fbshipit-source-id: d032be2 --- infer/src/checkers/ThreadSafety.ml | 3 +-- infer/tests/codetoanalyze/java/threadsafety/Dispatch.java | 4 ++-- infer/tests/codetoanalyze/java/threadsafety/issues.exp | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 1e6c27ec3..8d41e50c2 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -1306,9 +1306,8 @@ let report_unsafe_accesses aggregated_access_map = if is_duplicate_report access pname reported_acc then reported_acc else match (TraceElem.kind access, pre) with - | Access.InterfaceCall unannoted_call_pname, AccessPrecondition.Unprotected _ + | Access.InterfaceCall _, AccessPrecondition.Unprotected _ -> (* un-annotated interface call + no lock. warn *) - report_unannotated_interface_violation tenv pdesc access unannoted_call_pname ; update_reported access pname reported_acc | Access.InterfaceCall _, AccessPrecondition.Protected _ -> (* un-annotated interface call, but it's protected by a lock/thread. don't report *) diff --git a/infer/tests/codetoanalyze/java/threadsafety/Dispatch.java b/infer/tests/codetoanalyze/java/threadsafety/Dispatch.java index 187144fb7..84004f7af 100644 --- a/infer/tests/codetoanalyze/java/threadsafety/Dispatch.java +++ b/infer/tests/codetoanalyze/java/threadsafety/Dispatch.java @@ -35,11 +35,11 @@ class NotThreadSafe { @ThreadSafe public class Dispatch { - void callUnannotatedInterfaceBad(UnannotatedInterface i) { + void FN_callUnannotatedInterfaceBad(UnannotatedInterface i) { i.foo(); } - void callUnannotatedInterfaceIndirectBad(NotThreadSafe s, UnannotatedInterface i) { + void FN_callUnannotatedInterfaceIndirectBad(NotThreadSafe s, UnannotatedInterface i) { s.notThreadSafeOk(i); } diff --git a/infer/tests/codetoanalyze/java/threadsafety/issues.exp b/infer/tests/codetoanalyze/java/threadsafety/issues.exp index 22d322126..e19373eab 100644 --- a/infer/tests/codetoanalyze/java/threadsafety/issues.exp +++ b/infer/tests/codetoanalyze/java/threadsafety/issues.exp @@ -47,8 +47,6 @@ codetoanalyze/java/threadsafety/DeDup.java, void DeDup.two_reads(), 3, THREAD_SA codetoanalyze/java/threadsafety/DeDup.java, void DeDup.two_writes(), 2, THREAD_SAFETY_VIOLATION, [access to `codetoanalyze.java.checkers.DeDup.field`] codetoanalyze/java/threadsafety/DeDup.java, void DeDup.write_read(), 2, THREAD_SAFETY_VIOLATION, [access to `codetoanalyze.java.checkers.DeDup.field`] codetoanalyze/java/threadsafety/DeDup.java, void DeDup.write_read(), 3, THREAD_SAFETY_VIOLATION, [,access to `codetoanalyze.java.checkers.DeDup.field`,,access to `codetoanalyze.java.checkers.DeDup.field`] -codetoanalyze/java/threadsafety/Dispatch.java, void Dispatch.callUnannotatedInterfaceBad(UnannotatedInterface), 1, THREAD_SAFETY_VIOLATION, [call to void UnannotatedInterface.foo()] -codetoanalyze/java/threadsafety/Dispatch.java, void Dispatch.callUnannotatedInterfaceIndirectBad(NotThreadSafe,UnannotatedInterface), 1, THREAD_SAFETY_VIOLATION, [call to void NotThreadSafe.notThreadSafeOk(UnannotatedInterface),call to void UnannotatedInterface.foo()] codetoanalyze/java/threadsafety/Locks.java, void Locks.FP_unlockOneLock(), 4, THREAD_SAFETY_VIOLATION, [access to `codetoanalyze.java.checkers.Locks.f`] codetoanalyze/java/threadsafety/Locks.java, void Locks.afterReentrantLockUnlockBad(), 3, THREAD_SAFETY_VIOLATION, [access to `codetoanalyze.java.checkers.Locks.f`] codetoanalyze/java/threadsafety/Locks.java, void Locks.afterUnlockBad(), 3, THREAD_SAFETY_VIOLATION, [access to `codetoanalyze.java.checkers.Locks.f`]