<AWT Dev> RFR: 8155874: Fix java.desktop deprecation warnings about Class.newInstance
philip.race at oracle.com
Mon Nov 7 18:49:28 UTC 2016
This hits all across the desktop module, hence the cross-post.
The Class.newInstance() has been deprecated since it
may throw checked exceptions that are not declared.
Class.getConstructor().newInstance() was recommended as a
replacement but it will return only public constructors.
So if you have package access to a package private constructor it will
as the previous pattern succeeded
So the recommendation now is to use
and this fix uses that except for some cases where we have a limited and
set of internal "service providers" which are known to use public
classes and constructors.
Also some exception catching has been cleaned up as appropriate for the
new method call and taking advantage of the JDK 1.7
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the awt-dev