< prev index next >

src/java.desktop/share/classes/java/awt/Toolkit.java

Print this page

        

@@ -461,12 +461,14 @@
      *
      * @param atName the name of the class to be loaded
      */
     private static void fallbackToLoadClassForAT(String atName) {
         try {
-            Class<?> c = Class.forName(atName, false, ClassLoader.getSystemClassLoader());
-            c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o = Class.forName(atName,
+                                     false,
+                                     ClassLoader.getSystemClassLoader()).newInstance();
         } catch (ClassNotFoundException e) {
             newAWTError(e, "Assistive Technology not found: " + atName);
         } catch (InstantiationException e) {
             newAWTError(e, "Could not instantiate Assistive Technology: " + atName);
         } catch (IllegalAccessException e) {

@@ -577,11 +579,13 @@
                             }
                         }
                     }
                     try {
                         if (cls != null) {
-                            toolkit = (Toolkit)cls.newInstance();
+                            @SuppressWarnings("deprecation")
+                            Object tmp = cls.newInstance();
+                            toolkit = (Toolkit)tmp;
                             if (GraphicsEnvironment.isHeadless()) {
                                 toolkit = new HeadlessToolkit(toolkit);
                             }
                         }
                     } catch (final InstantiationException ignored) {
< prev index next >