Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/valuebased/ComplexValueBasedHierarchy.java
Bas Leijdekkers 2b32d9bb56 Java: basic support for Valhalla Value Classes (IDEA-364548)
GitOrigin-RevId: 93b0394866aae35772ccc90e7de822af8a94c6ce
2024-12-18 18:05:29 +00:00

34 lines
1.0 KiB
Java

import valuebased.classes.OpenValueBased;
class One extends OpenValueBased { }
class Two extends One { }
class Three extends Two { }
class ComplexVBHierarchy extends Three { }
class Main {
final ComplexVBHierarchy vb = new ComplexVBHierarchy();
{
final ComplexVBHierarchy localVb = new ComplexVBHierarchy();
final Object objectVb = new ComplexVBHierarchy();
synchronized (<warning descr="Synchronization on instance of value-based class">vb</warning>) {}
synchronized (<warning descr="Synchronization on instance of value-based class">localVb</warning>) {}
synchronized (<warning descr="Synchronization on instance of value-based class">objectVb</warning>) {}
synchronized (ComplexVBHierarchy.class) {}
f(vb);
g(vb);
}
void f(ComplexVBHierarchy vb) {
synchronized (<warning descr="Synchronization on instance of value-based class">vb</warning>) {}
}
void g(Object vb) {
synchronized (vb) {}
}
@SuppressWarnings("synchronization")
void h(ComplexVBHierarchy vb) {
synchronized (vb) {}
}
}