JEP proposed to target JDK 16: 390: Warnings for Value-Based Classes

Florian Weimer fweimer at
Wed Dec 2 09:32:38 UTC 2020

* mark reinhold:

> The following JEP is proposed to target JDK 16:
>   390: Warnings for Value-Based Classes
>   Summary: Designate the primitive wrapper classes as value-based and
>   deprecate their constructors for removal, prompting new deprecation
>   warnings.  Provide warnings about improper attempts to synchronize on
>   instances of any value-based classes in the Java Platform.
> Feedback on this proposal from JDK Project Committers and Reviewers [1]
> is more than welcome, as are reasoned objections.  If no such objections
> are raised by 23:59 UTC on Monday, 7 December, or if they’re raised and
> then satisfactorily answered, then per the JEP 2.0 process proposal [2]
> I’ll target this JEP to JDK 16.

The proposal does not discuss the concurrency impact of a switch to
primitive types.  I expect that lot of code has data races on fields
whose type is a value-based class, and these races are largely
recognized as benign today.  I think the default choice for primitive
types will be that data races can observe invalid states, and it would
be nice to tell developers if that's going to happen for e.g. immutable

(Sorry if I brought this up before; I think I did but I can't recall a

Red Hat GmbH, , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill

More information about the jdk-dev mailing list