synchronized
statement.
A lock expression for this synchronized
statement must be equal to
this
for instance methods or [ClassName].class
for static methods.
To improve readability of such methods,
you can remove the synchronized
wrapper and mark the method as synchronized
.
Example:
public int generateInt(int x) {
synchronized (this) {
return 1;
}
}
After the quick-fix is applied:
public synchronized int generateInt(int x) {
return 1;
}