<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
bug: <a class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-8155874">https://bugs.openjdk.java.net/browse/JDK-8155874</a><br>
Webrev: <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~prr/8155874/">http://cr.openjdk.java.net/~prr/8155874/</a><br>
<br>
This hits all across the desktop module, hence the cross-post.<br>
<br>
The Class.newInstance() has been deprecated since it<br>
may throw checked exceptions that are not declared.<br>
<br>
Class.getConstructor().newInstance() was recommended as a<br>
replacement but it will return only public constructors.<br>
<br>
So if you have package access to a package private constructor it
will fail where<br>
as the previous pattern succeeded<br>
<br>
So the recommendation now is to useĀ
Class.getDeclaredConstructor().newInstance()<br>
and this fix uses that except for some cases where we have a limited
and known<br>
set of internal "service providers" which are known to use public
classes and constructors.<br>
<br>
Also some exception catching has been cleaned up as appropriate for
the<br>
new method call and taking advantage of the JDK 1.7 <span
class="changed">ReflectiveOperationException</span><br>
<br>
-phil.<br>
<br>
</body>
</html>