1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
/*
* @test /nodynamiccopyright/
* @bug 8254274
* @summary lint should warn when an instance of a value based class is synchronized upon
* @compile/fail/ref=JdkInternalAbuseOfVbc.out --patch-module java.base=${test.src} -XDrawDiagnostics -Werror -Xlint SomeVbc.java JdkInternalAbuseOfVbc.java
*/
package java.lang;
public final class JdkInternalAbuseOfVbc {
public JdkInternalAbuseOfVbc() {}
void abuseVbc(SomeVbc vbc) {
synchronized(this) { // OK
synchronized (vbc) { // WARN
}
}
}
}
|