8042871: Fix raw and unchecked warnings in sun.audio
authordarcy
Mon, 19 May 2014 10:03:58 -0700
changeset 25091 e69235b071ef
parent 25090 83a78ff886e6
child 25092 b35eb67cf1e3
8042871: Fix raw and unchecked warnings in sun.audio Reviewed-by: serb
jdk/src/share/classes/sun/audio/AudioDevice.java
jdk/src/share/classes/sun/audio/AudioPlayer.java
jdk/src/share/classes/sun/audio/AudioStreamSequence.java
--- a/jdk/src/share/classes/sun/audio/AudioDevice.java	Mon May 19 16:48:41 2014 +0400
+++ b/jdk/src/share/classes/sun/audio/AudioDevice.java	Mon May 19 10:03:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,10 +58,7 @@
 
     private boolean DEBUG = false  /*true*/ ;
 
-    /** Hashtable of audio clips / input streams. */
-    private Hashtable clipStreams;
-
-    private Vector infos;
+    private Vector<Info> infos;
 
     /** Are we currently playing audio? */
     private boolean playing = false;
@@ -81,9 +78,7 @@
      * Create an AudioDevice instance.
      */
     private AudioDevice() {
-
-        clipStreams = new Hashtable();
-        infos = new Vector();
+        infos = new Vector<>();
     }
 
 
@@ -161,7 +156,7 @@
 
         // is this already playing?  if so, then just return
         for(int i=0; i<infos.size(); i++) {
-            info = (AudioDevice.Info)infos.elementAt(i);
+            info = infos.elementAt(i);
             if( info.in == in ) {
 
                 return;
@@ -290,7 +285,7 @@
 
         for(int i=0; i<infos.size(); i++) {
 
-            info = (AudioDevice.Info)infos.elementAt(i);
+            info = infos.elementAt(i);
 
             if( info.in == in ) {
 
@@ -355,7 +350,7 @@
 
         for(int i=0; i<infos.size(); i++) {
 
-            info = (AudioDevice.Info)infos.elementAt(i);
+            info = infos.elementAt(i);
 
             if( info.sequencer != null ) {
 
@@ -375,8 +370,7 @@
             System.err.println("Audio Device: Streams all closed.");
         }
         // Empty the hash table.
-        clipStreams = new Hashtable();
-        infos = new Vector();
+        infos = new Vector<>();
     }
 
     /**
--- a/jdk/src/share/classes/sun/audio/AudioPlayer.java	Mon May 19 16:48:41 2014 +0400
+++ b/jdk/src/share/classes/sun/audio/AudioPlayer.java	Mon May 19 10:03:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,18 +92,16 @@
         private static AudioPlayer getAudioPlayer() {
 
             if(DEBUG) { System.out.println("> AudioPlayer.getAudioPlayer()"); }
-            AudioPlayer audioPlayer;
-            PrivilegedAction action = new PrivilegedAction() {
-                    public Object run() {
-                        Thread t = new AudioPlayer();
+            PrivilegedAction<AudioPlayer> action = new PrivilegedAction<AudioPlayer>() {
+                    public AudioPlayer run() {
+                        AudioPlayer t = new AudioPlayer();
                         t.setPriority(MAX_PRIORITY);
                         t.setDaemon(true);
                         t.start();
                         return t;
                     }
                 };
-            audioPlayer = (AudioPlayer) AccessController.doPrivileged(action);
-            return audioPlayer;
+            return  AccessController.doPrivileged(action);
         }
 
         /**
--- a/jdk/src/share/classes/sun/audio/AudioStreamSequence.java	Mon May 19 16:48:41 2014 +0400
+++ b/jdk/src/share/classes/sun/audio/AudioStreamSequence.java	Mon May 19 10:03:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,16 +44,11 @@
  * @author Arthur van Hoff
  */
 public final class AudioStreamSequence extends SequenceInputStream {
-
-        Enumeration e;
-        InputStream in;
-
         /**
          * Create an AudioStreamSequence given an
          * enumeration of streams.
          */
-        public AudioStreamSequence(Enumeration e) {
+        public AudioStreamSequence(Enumeration<? extends InputStream> e) {
             super(e);
         }
-
-    }
+}