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
24 lines
838 B
Java
24 lines
838 B
Java
/*
|
|
* @test /nodynamiccopyright/
|
|
* @bug 8254274
|
|
* @summary lint should warn when an instance of a value based class is synchronized upon
|
|
* @compile/fail/ref=ExternalAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint ExternalAbuseOfVbc.java
|
|
* @compile/fail/ref=ExternalAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint:all ExternalAbuseOfVbc.java
|
|
* @compile/fail/ref=ExternalAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint:synchronization ExternalAbuseOfVbc.java
|
|
* @compile/ref=LintModeOffAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint:-synchronization ExternalAbuseOfVbc.java
|
|
*/
|
|
|
|
public final class ExternalAbuseOfVbc {
|
|
|
|
final Integer val = Integer.valueOf(42);
|
|
final String ref = "String";
|
|
|
|
void abuseVbc() {
|
|
synchronized(ref) { // OK
|
|
synchronized (val) { // WARN
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|