mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-07 19:36:56 +07:00
This patch adds the inspection to detect usages of value-based classes' instances as monitors in the synchronize statement. Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com> GitOrigin-RevId: 178533c1415b2a8f11d48db17c19baa7e6ff4d1a
26 lines
821 B
Java
26 lines
821 B
Java
import valuebased.classes.IValueBased;
|
|
|
|
class IVB implements IValueBased {
|
|
final IVB vb = new IVB();
|
|
{
|
|
final IVB localVb = new IVB();
|
|
final Object objectVb = new IVB();
|
|
|
|
synchronized (<warning descr="Attempt to synchronize on an instance of a value-based class">vb</warning>) {}
|
|
synchronized (<warning descr="Attempt to synchronize on an instance of a value-based class">localVb</warning>) {}
|
|
synchronized (<warning descr="Attempt to synchronize on an instance of a value-based class">objectVb</warning>) {}
|
|
synchronized (IValueBased.class) {}
|
|
synchronized (IVB.class) {}
|
|
f(vb);
|
|
g(vb);
|
|
}
|
|
|
|
void f(IVB vb) {
|
|
synchronized (<warning descr="Attempt to synchronize on an instance of a value-based class">vb</warning>) {}
|
|
}
|
|
|
|
void g(Object vb) {
|
|
synchronized (vb) {}
|
|
}
|
|
}
|