src/share/classes/javax/sound/sampled/AudioSystem.java

Print this page

        

@@ -173,12 +173,12 @@
      *         returned.
      * @see #getMixer
      */
     public static Mixer.Info[] getMixerInfo() {
 
-        List infos = getMixerInfoList();
-        Mixer.Info[] allInfos = (Mixer.Info[]) infos.toArray(new Mixer.Info[infos.size()]);
+        List<Mixer.Info> infos = getMixerInfoList();
+        Mixer.Info[] allInfos = infos.toArray(new Mixer.Info[infos.size()]);
         return allInfos;
     }
 
     /**
      * Obtains the requested audio mixer.

@@ -193,16 +193,16 @@
      * @see #getMixerInfo
      */
     public static Mixer getMixer(Mixer.Info info) {
 
         Mixer mixer = null;
-        List providers = getMixerProviders();
+        List<MixerProvider> providers = getMixerProviders();
 
         for(int i = 0; i < providers.size(); i++ ) {
 
             try {
-                return ((MixerProvider)providers.get(i)).getMixer(info);
+                return providers.get(i).getMixer(info);
 
             } catch (IllegalArgumentException e) {
             } catch (NullPointerException e) {
                 // $$jb 08.20.99:  If the strings in the info object aren't
                 // set, then Netscape (using jdk1.1.5) tends to throw

@@ -215,11 +215,11 @@
 
         //$$fb if looking for default mixer, and not found yet, add a round of looking
         if (info == null) {
             for(int i = 0; i < providers.size(); i++ ) {
                 try {
-                    MixerProvider provider = (MixerProvider) providers.get(i);
+                    MixerProvider provider = providers.get(i);
                     Mixer.Info[] infos = provider.getMixerInfo();
                     // start from 0 to last device (do not reverse this order)
                     for (int ii = 0; ii < infos.length; ii++) {
                         try {
                             return provider.getMixer(infos[ii]);

@@ -251,11 +251,11 @@
      *         supported, an array of length 0 is returned.
      * @see Mixer#getSourceLineInfo(Line.Info)
      */
     public static Line.Info[] getSourceLineInfo(Line.Info info) {
 
-        Vector vector = new Vector();
+        Vector<Line.Info> vector = new Vector<>();
         Line.Info[] currentInfoArray;
 
         Mixer mixer;
         Line.Info fullInfo = null;
         Mixer.Info[] infoArray = getMixerInfo();

@@ -271,11 +271,11 @@
         }
 
         Line.Info[] returnedArray = new Line.Info[vector.size()];
 
         for (int i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vector.get(i);
+            returnedArray[i] = vector.get(i);
         }
 
         return returnedArray;
     }
 

@@ -290,11 +290,11 @@
      *         supported, an array of length 0 is returned.
      * @see Mixer#getTargetLineInfo(Line.Info)
      */
     public static Line.Info[] getTargetLineInfo(Line.Info info) {
 
-        Vector vector = new Vector();
+        Vector<Line.Info> vector = new Vector<>();
         Line.Info[] currentInfoArray;
 
         Mixer mixer;
         Line.Info fullInfo = null;
         Mixer.Info[] infoArray = getMixerInfo();

@@ -310,11 +310,11 @@
         }
 
         Line.Info[] returnedArray = new Line.Info[vector.size()];
 
         for (int i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vector.get(i);
+            returnedArray[i] = vector.get(i);
         }
 
         return returnedArray;
     }
 

@@ -380,11 +380,11 @@
      *         one line matching the specified {@code Line.Info} object through
      *         any installed mixer
      */
     public static Line getLine(Line.Info info) throws LineUnavailableException {
         LineUnavailableException lue = null;
-        List providers = getMixerProviders();
+        List<MixerProvider> providers = getMixerProviders();
 
 
         // 1: try from default mixer for this line class
         try {
             Mixer mixer = getDefaultMixer(providers, info);

@@ -399,11 +399,11 @@
         }
 
 
         // 2: if that doesn't work, try to find any mixing mixer
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             Mixer.Info[] infos = provider.getMixerInfo();
 
             for (int j = 0; j < infos.length; j++) {
                 try {
                     Mixer mixer = provider.getMixer(infos[j]);

@@ -421,11 +421,11 @@
         }
 
 
         // 3: if that didn't work, try to find any non-mixing mixer
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             Mixer.Info[] infos = provider.getMixerInfo();
             for (int j = 0; j < infos.length; j++) {
                 try {
                     Mixer mixer = provider.getMixer(infos[j]);
                     // see if this is an appropriate mixer which can mix

@@ -698,26 +698,26 @@
      *         length of at least 1, representing {@code sourceEncoding}
      *         (no conversion).
      */
     public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding) {
 
-        List codecs = getFormatConversionProviders();
-        Vector encodings = new Vector();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
+        Vector<AudioFormat.Encoding> encodings = new Vector<>();
 
         AudioFormat.Encoding encs[] = null;
 
         // gather from all the codecs
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if( codec.isSourceEncodingSupported( sourceEncoding ) ) {
                 encs = codec.getTargetEncodings();
                 for (int j = 0; j < encs.length; j++) {
                     encodings.addElement( encs[j] );
                 }
             }
         }
-        AudioFormat.Encoding encs2[] = (AudioFormat.Encoding[]) encodings.toArray(new AudioFormat.Encoding[0]);
+        AudioFormat.Encoding encs2[] = encodings.toArray(new AudioFormat.Encoding[0]);
         return encs2;
     }
 
     // $$fb 2002-04-12: fix for 4662082: behavior of AudioSystem.getTargetEncodings() methods doesn't match the spec
 

@@ -733,30 +733,30 @@
      *         {@code sourceFormat} (no conversion).
      */
     public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
 
 
-        List codecs = getFormatConversionProviders();
-        Vector encodings = new Vector();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
+        Vector<AudioFormat.Encoding[]> encodings = new Vector<>();
 
         int size = 0;
         int index = 0;
         AudioFormat.Encoding encs[] = null;
 
         // gather from all the codecs
 
         for(int i=0; i<codecs.size(); i++ ) {
-            encs = ((FormatConversionProvider) codecs.get(i)).getTargetEncodings(sourceFormat);
+            encs = codecs.get(i).getTargetEncodings(sourceFormat);
             size += encs.length;
             encodings.addElement( encs );
         }
 
         // now build a new array
 
         AudioFormat.Encoding encs2[] = new AudioFormat.Encoding[size];
         for(int i=0; i<encodings.size(); i++ ) {
-            encs = (AudioFormat.Encoding [])(encodings.get(i));
+            encs = encodings.get(i);
             for(int j=0; j<encs.length; j++ ) {
                 encs2[index++] = encs[j];
             }
         }
         return encs2;

@@ -772,14 +772,14 @@
      *         {@code false}
      */
     public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
 
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if(codec.isConversionSupported(targetEncoding,sourceFormat) ) {
                 return true;
             }
         }
         return false;

@@ -799,14 +799,14 @@
      * @see #getAudioInputStream(AudioFormat, AudioInputStream)
      */
     public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding,
                                                        AudioInputStream sourceStream) {
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i = 0; i < codecs.size(); i++) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) {
                 return codec.getAudioInputStream( targetEncoding, sourceStream );
             }
         }
         // we ran out of options, throw an exception

@@ -823,31 +823,31 @@
      * @return array of formats. If no formats of the specified encoding are
      *         supported, an array of length 0 is returned.
      */
     public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
 
-        List codecs = getFormatConversionProviders();
-        Vector formats = new Vector();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
+        Vector<AudioFormat[]> formats = new Vector<>();
 
         int size = 0;
         int index = 0;
         AudioFormat fmts[] = null;
 
         // gather from all the codecs
 
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
             size += fmts.length;
             formats.addElement( fmts );
         }
 
         // now build a new array
 
         AudioFormat fmts2[] = new AudioFormat[size];
         for(int i=0; i<formats.size(); i++ ) {
-            fmts = (AudioFormat [])(formats.get(i));
+            fmts = formats.get(i);
             for(int j=0; j<fmts.length; j++ ) {
                 fmts2[index++] = fmts[j];
             }
         }
         return fmts2;

@@ -862,14 +862,14 @@
      * @return {@code true} if the conversion is supported, otherwise
      *         {@code false}
      */
     public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) {
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if(codec.isConversionSupported(targetFormat, sourceFormat) ) {
                 return true;
             }
         }
         return false;

@@ -893,14 +893,14 @@
 
         if (sourceStream.getFormat().matches(targetFormat)) {
             return sourceStream;
         }
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i = 0; i < codecs.size(); i++) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) {
                 return codec.getAudioInputStream(targetFormat,sourceStream);
             }
         }
 

@@ -929,15 +929,15 @@
      * @see InputStream#mark
      */
     public static AudioFileFormat getAudioFileFormat(InputStream stream)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 format = reader.getAudioFileFormat( stream ); // throws IOException
                 break;
             } catch (UnsupportedAudioFileException e) {
                 continue;

@@ -964,15 +964,15 @@
      * @throws IOException if an input/output exception occurs
      */
     public static AudioFileFormat getAudioFileFormat(URL url)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 format = reader.getAudioFileFormat( url ); // throws IOException
                 break;
             } catch (UnsupportedAudioFileException e) {
                 continue;

@@ -999,15 +999,15 @@
      * @throws IOException if an I/O exception occurs
      */
     public static AudioFileFormat getAudioFileFormat(File file)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 format = reader.getAudioFileFormat( file ); // throws IOException
                 break;
             } catch (UnsupportedAudioFileException e) {
                 continue;

@@ -1042,15 +1042,15 @@
      * @see InputStream#mark
      */
     public static AudioInputStream getAudioInputStream(InputStream stream)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioInputStream audioStream = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 audioStream = reader.getAudioInputStream( stream ); // throws IOException
                 break;
             } catch (UnsupportedAudioFileException e) {
                 continue;

@@ -1077,15 +1077,15 @@
      * @throws IOException if an I/O exception occurs
      */
     public static AudioInputStream getAudioInputStream(URL url)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioInputStream audioStream = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 audioStream = reader.getAudioInputStream( url ); // throws IOException
                 break;
             } catch (UnsupportedAudioFileException e) {
                 continue;

@@ -1112,15 +1112,15 @@
      * @throws IOException if an I/O exception occurs
      */
     public static AudioInputStream getAudioInputStream(File file)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioInputStream audioStream = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 audioStream = reader.getAudioInputStream( file ); // throws IOException
                 break;
             } catch (UnsupportedAudioFileException e) {
                 continue;

@@ -1140,21 +1140,21 @@
      *
      * @return array of unique file types. If no file types are supported, an
      *         array of length 0 is returned.
      */
     public static AudioFileFormat.Type[] getAudioFileTypes() {
-        List providers = getAudioFileWriters();
-        Set returnTypesSet = new HashSet();
+        List<AudioFileWriter> providers = getAudioFileWriters();
+        Set<AudioFileFormat.Type> returnTypesSet = new HashSet<>();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             AudioFileFormat.Type[] fileTypes = writer.getAudioFileTypes();
             for(int j=0; j < fileTypes.length; j++) {
                 returnTypesSet.add(fileTypes[j]);
             }
         }
-        AudioFileFormat.Type returnTypes[] = (AudioFileFormat.Type[])
+        AudioFileFormat.Type returnTypes[] =
             returnTypesSet.toArray(new AudioFileFormat.Type[0]);
         return returnTypes;
     }
 
     /**

@@ -1165,14 +1165,14 @@
      * @return {@code true} if the file type is supported, otherwise
      *         {@code false}
      */
     public static boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             if (writer.isFileTypeSupported(fileType)) {
                 return true;
             }
         }
         return false;

@@ -1186,21 +1186,21 @@
      *         support is queried
      * @return array of file types. If no file types are supported, an array of
      *         length 0 is returned.
      */
     public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
-        List providers = getAudioFileWriters();
-        Set returnTypesSet = new HashSet();
+        List<AudioFileWriter> providers = getAudioFileWriters();
+        Set<AudioFileFormat.Type> returnTypesSet = new HashSet<>();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             AudioFileFormat.Type[] fileTypes = writer.getAudioFileTypes(stream);
             for(int j=0; j < fileTypes.length; j++) {
                 returnTypesSet.add(fileTypes[j]);
             }
         }
-        AudioFileFormat.Type returnTypes[] = (AudioFileFormat.Type[])
+        AudioFileFormat.Type returnTypes[] =
             returnTypesSet.toArray(new AudioFileFormat.Type[0]);
         return returnTypes;
     }
 
     /**

@@ -1213,14 +1213,14 @@
      *         stream, otherwise {@code false}
      */
     public static boolean isFileTypeSupported(AudioFileFormat.Type fileType,
                                               AudioInputStream stream) {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             if(writer.isFileTypeSupported(fileType, stream)) {
                 return true;
             }
         }
         return false;

@@ -1246,16 +1246,16 @@
      * @see #getAudioFileTypes
      */
     public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
                             OutputStream out) throws IOException {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
         int bytesWritten = 0;
         boolean flag = false;
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             try {
                 bytesWritten = writer.write( stream, fileType, out ); // throws IOException
                 flag = true;
                 break;
             } catch (IllegalArgumentException e) {

@@ -1286,16 +1286,16 @@
      * @see #getAudioFileTypes
      */
     public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
                             File out) throws IOException {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
         int bytesWritten = 0;
         boolean flag = false;
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             try {
                 bytesWritten = writer.write( stream, fileType, out ); // throws IOException
                 flag = true;
                 break;
             } catch (IllegalArgumentException e) {

@@ -1313,12 +1313,13 @@
     // METHODS FOR INTERNAL IMPLEMENTATION USE
 
     /**
      * Obtains the set of MixerProviders on the system.
      */
-    private static List getMixerProviders() {
-        return getProviders(MixerProvider.class);
+    @SuppressWarnings("unchecked")
+    private static List<MixerProvider> getMixerProviders() {
+        return (List<MixerProvider>) getProviders(MixerProvider.class);
     }
 
     /**
      * Obtains the set of format converters (codecs, transcoders, etc.) that are
      * currently installed on the system.

@@ -1326,12 +1327,13 @@
      * @return an array of {@link javax.sound.sampled.spi.FormatConversionProvider
      *         FormatConversionProvider} objects representing the available
      *         format converters. If no format converters readers are available
      *         on the system, an array of length 0 is returned.
      */
-    private static List getFormatConversionProviders() {
-        return getProviders(FormatConversionProvider.class);
+    @SuppressWarnings("unchecked")
+    private static List<FormatConversionProvider> getFormatConversionProviders() {
+        return (List<FormatConversionProvider>) getProviders(FormatConversionProvider.class);
     }
 
     /**
      * Obtains the set of audio file readers that are currently installed on the
      * system.

@@ -1339,12 +1341,13 @@
      * @return a List of {@link javax.sound.sampled.spi.AudioFileReader
      *         AudioFileReader} objects representing the installed audio file
      *         readers. If no audio file readers are available on the system, an
      *         empty List is returned.
      */
-    private static List getAudioFileReaders() {
-        return getProviders(AudioFileReader.class);
+    @SuppressWarnings("unchecked")
+    private static List<AudioFileReader> getAudioFileReaders() {
+        return (List<AudioFileReader>)getProviders(AudioFileReader.class);
     }
 
     /**
      * Obtains the set of audio file writers that are currently installed on the
      * system.

@@ -1352,12 +1355,13 @@
      * @return a List of {@link javax.sound.sampled.spi.AudioFileWriter
      *         AudioFileWriter} objects representing the available audio file
      *         writers. If no audio file writers are available on the system, an
      *         empty List is returned.
      */
-    private static List getAudioFileWriters() {
-        return getProviders(AudioFileWriter.class);
+    @SuppressWarnings("unchecked")
+    private static List<AudioFileWriter> getAudioFileWriters() {
+        return (List<AudioFileWriter>)getProviders(AudioFileWriter.class);
     }
 
     /**
      * Attempts to locate and return a default Mixer that provides lines of the
      * specified type.

@@ -1366,12 +1370,12 @@
      * @param  info The requested line type TargetDataLine.class, Clip.class or
      *         Port.class
      * @return a Mixer that matches the requirements, or null if no default
      *         mixer found
      */
-    private static Mixer getDefaultMixer(List providers, Line.Info info) {
-        Class lineClass = info.getLineClass();
+    private static Mixer getDefaultMixer(List<MixerProvider> providers, Line.Info info) {
+        Class<?> lineClass = info.getLineClass();
         String providerClassName = JDK13Services.getDefaultProviderClassName(lineClass);
         String instanceName = JDK13Services.getDefaultInstanceName(lineClass);
         Mixer mixer;
 
         if (providerClassName != null) {

@@ -1416,13 +1420,13 @@
      * @param  providerClassName The class name of the provider to be returned
      * @param  providers The list of MixerProviders that is searched
      * @return A MixerProvider of the requested class, or null if none is found
      */
     private static MixerProvider getNamedProvider(String providerClassName,
-                                                  List providers) {
+                                                  List<MixerProvider> providers) {
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             if (provider.getClass().getName().equals(providerClassName)) {
                 return provider;
             }
         }
         return null;

@@ -1460,14 +1464,14 @@
      * @param  providers The List of MixerProviders to check for Mixers
      * @param  info The type of line the returned Mixer is required to support
      * @return A Mixer matching the requirements, or null if none is found
      */
     private static Mixer getNamedMixer(String mixerName,
-                                       List providers,
+                                       List<MixerProvider> providers,
                                        Line.Info info) {
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             Mixer mixer = getNamedMixer(mixerName, provider, info);
             if (mixer != null) {
                 return mixer;
             }
         }

@@ -1509,11 +1513,11 @@
                                               Line.Info lineInfo,
                                               boolean isMixingRequired) {
         if (! mixer.isLineSupported(lineInfo)) {
             return false;
         }
-        Class lineClass = lineInfo.getLineClass();
+        Class<?> lineClass = lineInfo.getLineClass();
         if (isMixingRequired
             && (SourceDataLine.class.isAssignableFrom(lineClass) ||
                 Clip.class.isAssignableFrom(lineClass))) {
             int maxLines = mixer.getMaxLines(lineInfo);
             return ((maxLines == NOT_SPECIFIED) || (maxLines > 1));

@@ -1522,26 +1526,26 @@
     }
 
     /**
      * Like getMixerInfo, but return List.
      */
-    private static List getMixerInfoList() {
-        List providers = getMixerProviders();
+    private static List<Mixer.Info> getMixerInfoList() {
+        List<MixerProvider> providers = getMixerProviders();
         return getMixerInfoList(providers);
     }
 
     /**
      * Like getMixerInfo, but return List.
      */
-    private static List getMixerInfoList(List providers) {
-        List infos = new ArrayList();
+    private static List<Mixer.Info> getMixerInfoList(List<MixerProvider> providers) {
+        List<Mixer.Info> infos = new ArrayList<>();
 
         Mixer.Info[] someInfos; // per-mixer
         Mixer.Info[] allInfos;  // for all mixers
 
         for(int i = 0; i < providers.size(); i++ ) {
-            someInfos = ((MixerProvider)providers.get(i)).getMixerInfo();
+            someInfos = providers.get(i).getMixerInfo();
 
             for (int j = 0; j < someInfos.length; j++) {
                 infos.add(someInfos[j]);
             }
         }

@@ -1554,9 +1558,9 @@
      * SPI mechanism in 1.3.
      *
      * @return a List of instances of providers for the requested service. If no
      *         providers are available, a vector of length 0 will be returned.
      */
-    private static List getProviders(Class providerClass) {
+    private static List<?> getProviders(Class<?> providerClass) {
         return JDK13Services.getProviders(providerClass);
     }
 }