-
Enhancement
-
Resolution: Unresolved
-
P4
-
17
Example 4.3.1-1 uses reflection, specifically Class::newInstance, to demonstrate object creation:
(Point)Class.forName("Point").newInstance();
Reflection is too sophisticated to show so early in the JLS, and in any case newInstance has been ordinarily deprecated since 9. When newInstance is terminally deprecated, the example should replace reflection with a simple `new Point()` clause. The mention of newInstance in 11.2.3 should be clarified at the same time to refer to Constructor::newInstance.
(Point)Class.forName("Point").newInstance();
Reflection is too sophisticated to show so early in the JLS, and in any case newInstance has been ordinarily deprecated since 9. When newInstance is terminally deprecated, the example should replace reflection with a simple `new Point()` clause. The mention of newInstance in 11.2.3 should be clarified at the same time to refer to Constructor::newInstance.
- duplicates
-
JDK-8283146 Example in 4.3.1 uses deprecated API
- Closed
- relates to
-
JDK-6850612 Deprecate Class.newInstance since it violates the checked exception language contract
- Resolved