Sonar Rule RSPEC-3077 (SonarSource Code Analyzers Rules Explorer) is also reported when someone uses Double Checked Locking.
RSPEC-2168 (SonarSource Code Analyzers Rules Explorer) even mentions using volatile as a compliant solution to ensure Double Checked Locking is Thread Safe.
Isn’t RSPEC-3077 a violation of RSPEC-2168?
Double checked Locking with volatile keyword prevents against both instruction reordering and memory visibility to different threads.
It is also mentioned as a correct solution for multi threading on JDK 5+ : The "Double-Checked Locking is Broken" Declaration
So, RSPEC-3077 should not be reported when it is used in the context of Double checked locking.