48d8650ae1
8254047: [JEP 390] Revise "value-based class" & apply to wrappers 8252181: [JEP 390] Define & apply annotation jdk.internal.ValueBased 8252183: [JEP 390] Add 'lint' warning for @ValueBased classes 8257027: [JEP 390] Diagnose synchronization on @ValueBased classes 8252180: [JEP 390] Deprecate wrapper class constructors for removal Co-authored-by: Roger Riggs <rriggs@openjdk.org> Co-authored-by: Srikanth Adayapalam <sadayapalam@openjdk.org> Co-authored-by: Lois Foltan <lfoltan@openjdk.org> Reviewed-by: rriggs, hseigel, mchung, darcy
23 lines
563 B
Java
23 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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|