Details about the known misuse from the MUBench dataset.
Description: | Synchronizes on an object and then again on the same object within the synchroized bock, thereby, producing a deadlock.
|
Fix Description: |
synchronize only once.
|
Violation Types: |
- superfluous/condition/threading
|
In File: | Deadlock.java |
In Method: | misuse(Object) |
Code with Misuse: |
class Deadlock {
public void misuse(Object o) {
synchronized (o) {
o.hashCode();
synchronized (o) {
o.hashCode();
}
}
}
}
|
Code with Pattern(s): |
public class Synchronized {
public void pattern(Object o) {
synchronized (o) {
o.hashCode();
o.hashCode();
}
}
}
|