changeset 10112:706c54018d1c

8042871: Fix raw and unchecked warnings in sun.audio Reviewed-by: serb
author darcy
date Mon, 19 May 2014 10:03:58 -0700
parents 46170b8aaccc
children b5f284a0059b
files src/share/classes/sun/audio/AudioDevice.java src/share/classes/sun/audio/AudioPlayer.java src/share/classes/sun/audio/AudioStreamSequence.java
diffstat 3 files changed, 15 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/audio/AudioDevice.java	Mon May 19 16:48:41 2014 +0400
+++ b/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/src/share/classes/sun/audio/AudioPlayer.java	Mon May 19 16:48:41 2014 +0400
+++ b/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/src/share/classes/sun/audio/AudioStreamSequence.java	Mon May 19 16:48:41 2014 +0400
+++ b/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);
         }
-
-    }
+}