Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
22 lines
563 B
Java
22 lines
563 B
Java
/*
|
|
* @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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|