<Sound Dev> JDK 9 RFR of JDK-8042871: Fix raw and unchecked warnings in sun.audio

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu May 15 19:16:28 UTC 2014


Hi. Joe.
It seems to me "Enumeration e" in AudioStreamSequence can be removed too.

On 5/15/14 10:08 AM, Joe Darcy wrote:
> Hello,
>
> Please review this fix for
>
>     JDK-8042871: Fix raw and unchecked warnings in sun.audio
>     http://cr.openjdk.java.net/~darcy/8042871.0/
>
> Patch below.
>
> Thanks,
>
> -Joe
>
> --- old/src/share/classes/sun/audio/AudioDevice.java    2014-05-14 
> 23:04:08.000000000 -0700
> +++ new/src/share/classes/sun/audio/AudioDevice.java    2014-05-14 
> 23:04:07.000000000 -0700
> @@ -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<>();
>      }
>
>      /**
> --- old/src/share/classes/sun/audio/AudioPlayer.java    2014-05-14 
> 23:04:08.000000000 -0700
> +++ new/src/share/classes/sun/audio/AudioPlayer.java    2014-05-14 
> 23:04:08.000000000 -0700
> @@ -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);
>          }
>
>          /**
> --- old/src/share/classes/sun/audio/AudioStreamSequence.java 
> 2014-05-14 23:04:09.000000000 -0700
> +++ new/src/share/classes/sun/audio/AudioStreamSequence.java 
> 2014-05-14 23:04:09.000000000 -0700
> @@ -45,14 +45,14 @@
>   */
>  public final class AudioStreamSequence extends SequenceInputStream {
>
> -        Enumeration e;
> +        Enumeration<? extends InputStream> e;
>          InputStream in;
>
>          /**
>           * Create an AudioStreamSequence given an
>           * enumeration of streams.
>           */
> -        public AudioStreamSequence(Enumeration e) {
> +        public AudioStreamSequence(Enumeration<? extends InputStream> 
> e) {
>              super(e);
>          }
>
>
>


-- 
Best regards, Sergey.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20140515/65df181c/attachment.html>


More information about the sound-dev mailing list