JDK-8354335 : No longer deprecate wrapper class constructors for removal
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-04-10
  • Updated: 2025-04-28
  • Resolved: 2025-04-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 masterFixed
Related Reports
CSR :  
Relates :  
Relates :  
Description
The constructors of primitive wrapper classes like Integer have been deprecated since Java 9, because they force the creation of wrapper objects with new identities, and it has long been discouraged to depend on the identity of a wrapper object.

In JEP 390, it was anticipated that the coming Value Classes and Objects feature would make this situation worse: when Integer became a value class, legacy binaries that had invoked a constructor would fail with a LinkageError. In anticipation of this problem, JEP 390 upgraded the deprecation of these constructors to "for removal", with the expectation that they would eventually be made private.

The design of Value Classes and Objects has since evolved, and it is no longer the case that making Integer a value class will break legacy binaries.

In fact, making Integer a value class will eliminate the motivation for deprecating these constructors in the first place: it will no longer be the case that constructor invocation will force the creation of new identities—value objects don't have identity.

Given these changes, it is no longer necessary for the wrapper class constructors to be deprecated "for removal", and they can revert to simply being deprecated. (After they have permanently become value classes, we can revisit whether to un-deprecate them completely.)
Comments
Changeset: 1fd136cd Branch: master Author: Roger Riggs <rriggs@openjdk.org> Date: 2025-04-28 21:36:14 +0000 URL: https://git.openjdk.org/jdk/commit/1fd136cd6b863ebee70e42b2966584218d0919ec
28-04-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24586 Date: 2025-04-10 22:05:04 +0000
10-04-2025

Note that this rule about value-based classes is still in force, and is not being violated by the wrapper classes: "the class does not declare (or has deprecated any) accessible constructors"
10-04-2025