JDK-8168681 : Correct deprecation text for Class.newInstance
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-10-25
  • Updated: 2016-11-11
  • Resolved: 2016-11-03
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 9
9 b144Fixed
Related Reports
Relates :  
Description
As found by Phil Race, the original substitution text for Class.newInstance (JDK-8159330) is not equivalent in all cases. This should be addressed.
Comments
Review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-November/044507.html
03-11-2016

The current suggested replacement text is "The call clazz.newInstance() can be replaced by clazz.getConstructor().newInstance()" However, using "getDeclaredConstructor()" is most likely the better replacement since it should be able to find and call non-public constructors when that is permissible.
25-10-2016