< prev index next >
src/java.desktop/share/classes/javax/swing/text/html/ObjectView.java
Print this page
@@ -44,11 +44,11 @@
* used to load the EditorKit. If the document's
* ClassLoader is null, <code>Class.forName</code> is used.
* <p>
* If the class can successfully be loaded, an attempt will
* be made to create an instance of it by calling
- * <code>Class.newInstance</code>. An attempt will be made
+ * <code>Class.getDeclaredConstructor().newInstance</code>. An attempt will be made
* to narrow the instance to type <code>java.awt.Component</code>
* to display the object.
* <p>
* This view can also manage a set of parameters with limitations.
* The parameters to the <object> element are expected to
@@ -90,11 +90,11 @@
String classname = (String) attr.getAttribute(HTML.Attribute.CLASSID);
try {
ReflectUtil.checkPackageAccess(classname);
Class<?> c = Class.forName(classname, true,Thread.currentThread().
getContextClassLoader());
- Object o = c.newInstance();
+ Object o = c.getDeclaredConstructor().newInstance();
if (o instanceof Component) {
Component comp = (Component) o;
setParameters(comp, attr);
return comp;
}
< prev index next >