rewrite-static-analysis icon indicating copy to clipboard operation
rewrite-static-analysis copied to clipboard

RSPEC-3046 - "wait" should not be called when multiple locks are held

Open yeikel opened this issue 1 year ago • 0 comments


synchronized (this.mon1) {  // threadB can't enter this block to request this.mon2 lock & release threadA
	synchronized (this.mon2) {
		this.mon2.wait();  // Noncompliant; threadA is stuck here holding lock on this.mon1
	}
}


See https://rules.sonarsource.com/java/RSPEC-3046

yeikel avatar Feb 27 '23 23:02 yeikel