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`]