8169887: javax/swing/JEditorPane/8080972/TestJEditor.java, javax/swing/text/View/8080972/TestObjectView.java are failing
authorprr
Tue, 22 Nov 2016 10:43:49 -0800
changeset 42218 35e0972b2533
parent 42217 53ac12e1344a
child 42219 5c88c0c3d165
8169887: javax/swing/JEditorPane/8080972/TestJEditor.java, javax/swing/text/View/8080972/TestObjectView.java are failing Reviewed-by: serb, alexsch
jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java
jdk/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java
jdk/src/java.desktop/share/classes/com/sun/beans/finder/InstanceFinder.java
jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java
jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java
jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java
jdk/src/java.desktop/share/classes/java/beans/Introspector.java
jdk/src/java.desktop/share/classes/java/beans/MetaData.java
jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java
jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java
jdk/src/java.desktop/share/classes/javax/swing/UIManager.java
jdk/src/java.desktop/share/classes/javax/swing/text/html/ObjectView.java
jdk/test/javax/swing/JEditorPane/8080972/TestJEditor.java
jdk/test/javax/swing/text/View/8080972/TestObjectView.java
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java	Tue Nov 22 10:43:49 2016 -0800
@@ -176,10 +176,11 @@
         }
 
         @Override
+        @SuppressWarnings("deprecation")
         T getInstance() {
             try {
                 ReflectUtil.checkPackageAccess(clazz);
-                return clazz.getDeclaredConstructor().newInstance();
+                return clazz.newInstance();
             } catch (ReflectiveOperationException ignored) {
             }
             return null;
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java	Tue Nov 22 10:43:49 2016 -0800
@@ -277,11 +277,12 @@
      * @param attributes  the attributes attached to the element
      */
     @Override
+    @SuppressWarnings("deprecation")
     public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
         ElementHandler parent = this.handler;
         try {
             this.handler =
-                getElementHandler(qName).getDeclaredConstructor().newInstance();
+                getElementHandler(qName).newInstance();
             this.handler.setOwner(this);
             this.handler.setParent(parent);
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/finder/InstanceFinder.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/finder/InstanceFinder.java	Tue Nov 22 10:43:49 2016 -0800
@@ -86,6 +86,7 @@
         return null;
     }
 
+    @SuppressWarnings("deprecation")
     protected T instantiate(Class<?> type, String name) {
         if (type != null) {
             try {
@@ -94,7 +95,7 @@
                 }
                 if (this.type.isAssignableFrom(type)) {
                     @SuppressWarnings("unchecked")
-                    T tmp = (T) type.getDeclaredConstructor().newInstance();
+                    T tmp = (T) type.newInstance();
                     return tmp;
                 }
             }
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Tue Nov 22 10:43:49 2016 -0800
@@ -1125,13 +1125,14 @@
             this.methodName = methodName;
         }
 
+        @SuppressWarnings("deprecation")
         public Object createValue(UIDefaults table) {
             try {
                 Class<?> c = Class.forName(className, true,Thread.currentThread().
                                            getContextClassLoader());
 
                 if (methodName == null) {
-                    return c.getDeclaredConstructor().newInstance();
+                    return c.newInstance();
                 }
                 Method m = c.getMethod(methodName, (Class<?>[])null);
 
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java	Tue Nov 22 10:43:49 2016 -0800
@@ -70,6 +70,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public Soundbank getSoundbank(URL url)
             throws InvalidMidiDataException, IOException {
         if (!isZIP(url))
@@ -90,7 +91,7 @@
                         Class<?> c = Class.forName(line.trim(), false, ucl);
                         if (Soundbank.class.isAssignableFrom(c)) {
                             ReflectUtil.checkPackageAccess(c);
-                            Object o = c.getDeclaredConstructor().newInstance();
+                            Object o = c.newInstance();
                             soundbanks.add((Soundbank) o);
                         }
                     } catch (ReflectiveOperationException ignored) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java	Tue Nov 22 10:43:49 2016 -0800
@@ -134,10 +134,11 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public ModelOscillatorStream open(float samplerate) {
         ModelAbstractOscillator oscs;
         try {
-            oscs = this.getClass().getDeclaredConstructor().newInstance();
+            oscs = this.getClass().newInstance();
         } catch (ReflectiveOperationException e) {
             throw new IllegalArgumentException(e);
         }
--- a/jdk/src/java.desktop/share/classes/java/beans/Introspector.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/Introspector.java	Tue Nov 22 10:43:49 2016 -0800
@@ -1279,6 +1279,7 @@
      * First try the classloader of "sibling", then try the system
      * classloader then the class loader of the current Thread.
      */
+    @SuppressWarnings("deprecation")
     static Object instantiate(Class<?> sibling, String className)
                  throws InstantiationException, IllegalAccessException,
                         NoSuchMethodException, InvocationTargetException,
@@ -1286,7 +1287,7 @@
         // First check with sibling's classloader (if any).
         ClassLoader cl = sibling.getClassLoader();
         Class<?> cls = ClassFinder.findClass(className, cl);
-        return cls.getDeclaredConstructor().newInstance();
+        return cls.newInstance();
     }
 
 } // end class Introspector
--- a/jdk/src/java.desktop/share/classes/java/beans/MetaData.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/MetaData.java	Tue Nov 22 10:43:49 2016 -0800
@@ -1219,7 +1219,7 @@
         internalPersistenceDelegates.put("java.sql.Time", new java_util_Date_PersistenceDelegate());
     }
 
-    @SuppressWarnings("rawtypes")
+    @SuppressWarnings({"rawtypes", "deprecation"})
     public static synchronized PersistenceDelegate getPersistenceDelegate(Class type) {
         if (type == null) {
             return nullPersistenceDelegate;
@@ -1263,7 +1263,7 @@
                 String name =  type.getName();
                 Class<?> c = Class.forName("java.beans.MetaData$" + name.replace('.', '_')
                                         + "_PersistenceDelegate");
-                pd = (PersistenceDelegate)c.getDeclaredConstructor().newInstance();
+                pd = (PersistenceDelegate)c.newInstance();
                 internalPersistenceDelegates.put(typeName, pd);
             }
             catch (ClassNotFoundException e) {
--- a/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java	Tue Nov 22 10:43:49 2016 -0800
@@ -461,6 +461,7 @@
      *         not been defined or cannot be created
      * @since 1.5
      */
+    @SuppressWarnings("deprecation")
     public PropertyEditor createPropertyEditor(Object bean) {
         Object editor = null;
 
@@ -470,14 +471,14 @@
             Constructor<?> ctor = null;
             if (bean != null) {
                 try {
-                    ctor = cls.getDeclaredConstructor(new Class<?>[] { Object.class });
+                    ctor = cls.getConstructor(new Class<?>[] { Object.class });
                 } catch (Exception ex) {
                     // Fall through
                 }
             }
             try {
                 if (ctor == null) {
-                    editor = cls.getDeclaredConstructor().newInstance();
+                    editor = cls.newInstance();
                 } else {
                     editor = ctor.newInstance(new Object[] { bean });
                 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java	Tue Nov 22 10:43:49 2016 -0800
@@ -1180,6 +1180,7 @@
      * @return the editor kit, or <code>null</code> if there is nothing
      *   registered for the given type
      */
+    @SuppressWarnings("deprecation")
     public static EditorKit createEditorKitForContentType(String type) {
         Hashtable<String, EditorKit> kitRegistry = getKitRegisty();
         EditorKit k = kitRegistry.get(type);
@@ -1197,7 +1198,7 @@
                     // registerEditorKitForContentType(type, class, null).
                     c = SwingUtilities.loadSystemClass(classname);
                 }
-                k = (EditorKit) c.getDeclaredConstructor().newInstance();
+                k = (EditorKit) c.newInstance();
                 kitRegistry.put(type, k);
             } catch (Throwable e) {
                 k = null;
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java	Tue Nov 22 10:43:49 2016 -0800
@@ -513,6 +513,7 @@
      *
      * @since 9
      */
+    @SuppressWarnings("deprecation")
     public static LookAndFeel createLookAndFeel(String name)
             throws UnsupportedLookAndFeelException {
         Objects.requireNonNull(name);
@@ -527,7 +528,7 @@
                     Class<?> cls = Class.forName(UIManager.class.getModule(),
                                                  info.getClassName());
                     LookAndFeel laf =
-                        (LookAndFeel) cls.getDeclaredConstructor().newInstance();
+                        (LookAndFeel) cls.newInstance();
                     if (!laf.isSupportedLookAndFeel()) {
                         break;
                     }
@@ -615,6 +616,7 @@
      * @throws ClassCastException if {@code className} does not identify
      *         a class that extends {@code LookAndFeel}
      */
+    @SuppressWarnings("deprecation")
     public static void setLookAndFeel(String className)
         throws ClassNotFoundException,
                InstantiationException,
@@ -629,7 +631,7 @@
             Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
             try {
                 LookAndFeel laf =
-                    (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
+                    (LookAndFeel)lnfClass.newInstance();
                 setLookAndFeel(laf);
             } catch (ReflectiveOperationException | IllegalArgumentException e) {
                 InstantiationException ex =
@@ -1097,6 +1099,7 @@
     /**
      * Finds the Multiplexing <code>LookAndFeel</code>.
      */
+    @SuppressWarnings("deprecation")
     private static LookAndFeel getMultiLookAndFeel() {
         LookAndFeel multiLookAndFeel = getLAFState().multiLookAndFeel;
         if (multiLookAndFeel == null) {
@@ -1105,7 +1108,7 @@
             try {
                 Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
                 multiLookAndFeel =
-                        (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
+                        (LookAndFeel)lnfClass.newInstance();
             } catch (Exception exc) {
                 System.err.println("UIManager: failed loading " + className);
             }
@@ -1420,6 +1423,7 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     private static void initializeAuxiliaryLAFs(Properties swingProps)
     {
         String auxLookAndFeelNames = swingProps.getProperty(auxiliaryLAFsKey);
@@ -1440,7 +1444,7 @@
             try {
                 Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
                 LookAndFeel newLAF =
-                        (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
+                        (LookAndFeel)lnfClass.newInstance();
                 newLAF.initialize();
                 auxLookAndFeels.addElement(newLAF);
             }
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/ObjectView.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/ObjectView.java	Tue Nov 22 10:43:49 2016 -0800
@@ -46,7 +46,7 @@
  * <p>
  * If the class can successfully be loaded, an attempt will
  * be made to create an instance of it by calling
- * <code>Class.getDeclaredConstructor().newInstance</code>.  An attempt will be made
+ * <code>Class.newInstance</code>.  An attempt will be made
  * to narrow the instance to type <code>java.awt.Component</code>
  * to display the object.
  * <p>
@@ -85,6 +85,7 @@
      * as a specification of the classname, which
      * we try to load.
      */
+    @SuppressWarnings("deprecation")
     protected Component createComponent() {
         AttributeSet attr = getElement().getAttributes();
         String classname = (String) attr.getAttribute(HTML.Attribute.CLASSID);
@@ -92,7 +93,7 @@
             ReflectUtil.checkPackageAccess(classname);
             Class<?> c = Class.forName(classname, true,Thread.currentThread().
                                        getContextClassLoader());
-            Object o = c.getDeclaredConstructor().newInstance();
+            Object o = c.newInstance();
             if (o instanceof Component) {
                 Component comp = (Component) o;
                 setParameters(comp, attr);
--- a/jdk/test/javax/swing/JEditorPane/8080972/TestJEditor.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/test/javax/swing/JEditorPane/8080972/TestJEditor.java	Tue Nov 22 10:43:49 2016 -0800
@@ -36,7 +36,7 @@
 
 /*
  * @test
- * @bug 8080972
+ * @bug 8080972 8169887
  * @summary Audit Core Reflection in module java.desktop for places that will
  *          require changes to work with modules
  * @author Alexander Scherbatiy
--- a/jdk/test/javax/swing/text/View/8080972/TestObjectView.java	Tue Nov 15 12:52:24 2016 +0530
+++ b/jdk/test/javax/swing/text/View/8080972/TestObjectView.java	Tue Nov 22 10:43:49 2016 -0800
@@ -32,7 +32,7 @@
 import javax.swing.text.html.ObjectView;
 /*
  * @test
- * @bug 8080972
+ * @bug 8080972 8169887
  * @summary Audit Core Reflection in module java.desktop for places that will
  *          require changes to work with modules
  * @author Alexander Scherbatiy