According to the description of the rule, infer should not check the method annotated with @VisibleForTesting.
In the example below, however, infer report a THREAD_SAFETY_VIOLATION warning at line 16
warning: Thread Safety Violation Read/Write race. Non-private method `B.readOutsideLock1Bad()` reads without synchronization from `this.mField`. Potentially races with write in method `B.writeUnderLockOk()`.
Reporting because the current class is annotated `@ThreadSafe`, so we assume that this method can run in parallel with other non-private methods in the class (including itself).
Version.
Infer version v1.1.0
OS.Ubuntu 22.04.3 LTS
Command.infer run -- mvn clean compile
I found a false positive about the rule THREAD_SAFETY_VIOLATION.
According to the description of the rule, infer should not check the method annotated with
@VisibleForTesting
. In the example below, however, infer report aTHREAD_SAFETY_VIOLATION
warning at line 16Hence, I think it is a fasle positive.