...
Code Block | ||
---|---|---|
| ||
public Object publicLock = new Object(); private void doSomething() { synchronized(publicLock) { // body } } |
It is possible for untrusted code to change the value of the lock object and foil all attempts to synchronize.
...
Code Block | ||
---|---|---|
| ||
private final Object privateLock = new Object(); private void doSomething() { synchronized(privateLock) { // body } } |
Noncompliant Code Example (String
constant)
...