src/share/classes/java/awt/Menu.java

Print this page
rev 9830 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by: darcy, prr

@@ -64,11 +64,11 @@
             initIDs();
         }
 
         AWTAccessor.setMenuAccessor(
             new AWTAccessor.MenuAccessor() {
-                public Vector<MenuComponent> getItems(Menu menu) {
+                public Vector<MenuItem> getItems(Menu menu) {
                     return menu.items;
                 }
             });
     }
 

@@ -76,11 +76,11 @@
      * A vector of the items that will be part of the Menu.
      *
      * @serial
      * @see #countItems()
      */
-    Vector<MenuComponent> items = new Vector<>();
+    Vector<MenuItem> items = new Vector<>();
 
     /**
      * This field indicates whether the menu has the
      * tear of property or not.  It will be set to
      * <code>true</code> if the menu has the tear off

@@ -250,11 +250,11 @@
     /*
      * This is called by the native code, so client code can't
      * be called on the toolkit thread.
      */
     final MenuItem getItemImpl(int index) {
-        return (MenuItem)items.elementAt(index);
+        return items.elementAt(index);
     }
 
     /**
      * Adds the specified menu item to this menu. If the
      * menu item has been part of another menu, removes it

@@ -542,11 +542,11 @@
       throws IOException, ClassNotFoundException, HeadlessException
     {
       // HeadlessException will be thrown from MenuComponent's readObject
       s.defaultReadObject();
       for(int i = 0; i < items.size(); i++) {
-        MenuItem item = (MenuItem)items.elementAt(i);
+        MenuItem item = items.elementAt(i);
         item.parent = this;
       }
     }
 
     /**