< prev index next >

src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java

Print this page
rev 1580 : 6727661: Code improvement and warnings removing from the swing/plaf packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: alexp
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>

@@ -2099,12 +2099,10 @@
      * <code>soundFile</code> filename. If this method is unable to
      * build a viable path name from the <code>baseClass</code> and
      * <code>soundFile</code> passed into this method, it will
      * return <code>null</code>.
      *
-     * @param baseClass    used as the root class/location to get the
-     *                     soundFile from
      * @param soundFile    the name of the audio file to be retrieved
      *                     from disk
      * @return             A byte[] with audio data or null
      * @since 1.4
      */

@@ -2117,13 +2115,13 @@
          * Class.getResource a security risk since it
          * can be used to load additional classes.
          * Class.getResourceAsStream just returns raw
          * bytes, which we can convert to a sound.
          */
-        byte[] buffer = (byte[])AccessController.doPrivileged(
-                                                 new PrivilegedAction() {
-                public Object run() {
+        byte[] buffer = AccessController.doPrivileged(
+                                                 new PrivilegedAction<byte[]>() {
+                public byte[] run() {
                     try {
                         InputStream resource = BasicLookAndFeel.this.
                             getClass().getResourceAsStream(soundFile);
                         if (resource == null) {
                             return null;

@@ -2181,13 +2179,13 @@
         if (audioAction != null) {
             Object[] audioStrings = (Object[])
                                     UIManager.get("AuditoryCues.playList");
             if (audioStrings != null) {
                 // create a HashSet to help us decide to play or not
-                HashSet audioCues = new HashSet();
-                for (int i = 0; i < audioStrings.length; i++) {
-                    audioCues.add(audioStrings[i]);
+                HashSet<Object> audioCues = new HashSet<Object>();
+                for (Object audioString : audioStrings) {
+                    audioCues.add(audioString);
                 }
                 // get the name of the Action
                 String actionName = (String)audioAction.getValue(Action.NAME);
                 // if the actionName is in the audioCues HashSet, play it.
                 if (audioCues.contains(actionName)) {

@@ -2234,11 +2232,11 @@
 
     /**
      * This class contains listener that watches for all the mouse
      * events that can possibly invoke popup on the component
      */
-    class AWTEventHelper implements AWTEventListener,PrivilegedAction {
+    class AWTEventHelper implements AWTEventListener,PrivilegedAction<Object> {
         AWTEventHelper() {
             super();
             AccessController.doPrivileged(this);
         }
 
< prev index next >