I'm checking this in.

This adds generics to javax.sound.

Tom

2006-12-17  Tom Tromey  <[EMAIL PROTECTED]>

        * javax/sound/sampled/BooleanControl.java (type): Removed unused
        field.
        * javax/sound/sampled/AudioSystem.java (getAudioFileTypes):
        Genericized.
        (getAudioInputStream): Removed unused variable.
        (getMixerInfo): Genericized.
        (getSourceLineInfo): Likewise.
        (getTargetEncodings): Likewise.
        (getTargetFormats): Likewise.
        (getTargetLineInfo): Likewise.
        * javax/sound/sampled/AudioFormat.java (properties): Genericized.
        (AudioFormat): Updated.
        * javax/sound/sampled/AudioFileFormat.java (properties): Genericized.
        (AudioFileFormat): Updated.

Index: javax/sound/sampled/AudioFileFormat.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/sound/sampled/AudioFileFormat.java,v
retrieving revision 1.2
diff -u -r1.2 AudioFileFormat.java
--- javax/sound/sampled/AudioFileFormat.java    10 Dec 2006 20:25:47 -0000      
1.2
+++ javax/sound/sampled/AudioFileFormat.java    17 Dec 2006 22:30:47 -0000
@@ -122,7 +122,7 @@
   private AudioFormat format;
   private Type type;
   private int frameLength;
-  private Map properties;
+  private Map<String, Object> properties;
 
   /**
    * Create a new AudioFileFormat given the type, the format, and the
@@ -138,7 +138,7 @@
     this.format = fmt;
     this.type = type;
     this.frameLength = frameLen;
-    this.properties = Collections.EMPTY_MAP;
+    this.properties = Collections.<String, Object> emptyMap();
   }
 
   /**
@@ -159,7 +159,7 @@
     this.format = fmt;
     this.type = type;
     this.frameLength = frameLen;
-    this.properties = Collections.unmodifiableMap(new HashMap(properties));
+    this.properties = Collections.unmodifiableMap(new HashMap<String, 
Object>(properties));
   }
 
   /**
@@ -177,7 +177,7 @@
     this.format = fmt;
     this.type = type;
     this.frameLength = frameLen;
-    this.properties = Collections.EMPTY_MAP;
+    this.properties = Collections.<String, Object> emptyMap();
   }
 
   /**
Index: javax/sound/sampled/AudioFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/sampled/AudioFormat.java,v
retrieving revision 1.2
diff -u -r1.2 AudioFormat.java
--- javax/sound/sampled/AudioFormat.java        10 Dec 2006 20:25:47 -0000      
1.2
+++ javax/sound/sampled/AudioFormat.java        17 Dec 2006 22:30:47 -0000
@@ -133,7 +133,7 @@
    */
   protected int sampleSizeInBits;
 
-  private Map properties;
+  private Map<String, Object> properties;
 
   /**
    * Create a new audio format, given various attributes of it.
@@ -158,7 +158,7 @@
     this.frameSize = frameSize;
     this.frameRate = frameRate;
     this.bigEndian = bigEndian;
-    this.properties = Collections.EMPTY_MAP;
+    this.properties = Collections.<String, Object> emptyMap();
   }
 
   /**
@@ -186,7 +186,7 @@
     this.frameSize = frameSize;
     this.frameRate = frameRate;
     this.bigEndian = bigEndian;
-    this.properties = Collections.unmodifiableMap(new HashMap(properties));
+    this.properties = Collections.unmodifiableMap(new HashMap<String, 
Object>(properties));
   }
 
   /**
@@ -218,7 +218,7 @@
       this.frameSize = (sampleSizeInBits + 7) / 8 * channels;
     this.frameRate = sampleRate;
     this.bigEndian = bigEndian;
-    this.properties = Collections.EMPTY_MAP;
+    this.properties = Collections.<String, Object> emptyMap();
   }
 
   /**
Index: javax/sound/sampled/AudioSystem.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/sampled/AudioSystem.java,v
retrieving revision 1.2
diff -u -r1.2 AudioSystem.java
--- javax/sound/sampled/AudioSystem.java        16 Mar 2006 16:01:22 -0000      
1.2
+++ javax/sound/sampled/AudioSystem.java        17 Dec 2006 22:30:47 -0000
@@ -160,7 +160,8 @@
    */
   public static AudioFileFormat.Type[] getAudioFileTypes()
   {
-    HashSet result = new HashSet();
+    HashSet<AudioFileFormat.Type> result
+      = new HashSet<AudioFileFormat.Type>();
     Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
     while (i.hasNext())
       {
@@ -169,7 +170,7 @@
         for (int j = 0; j < types.length; ++j)
           result.add(types[j]);
       }
-    return (AudioFileFormat.Type[]) result.toArray(new 
AudioFileFormat.Type[result.size()]);
+    return result.toArray(new AudioFileFormat.Type[result.size()]);
   }
 
   /**
@@ -180,7 +181,8 @@
    */
   public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais)
   {
-    HashSet result = new HashSet();
+    HashSet<AudioFileFormat.Type> result
+      = new HashSet<AudioFileFormat.Type>();
     Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
     while (i.hasNext())
       {
@@ -189,7 +191,7 @@
         for (int j = 0; j < types.length; ++j)
           result.add(types[j]);
       }
-    return (AudioFileFormat.Type[]) result.toArray(new 
AudioFileFormat.Type[result.size()]);
+    return result.toArray(new AudioFileFormat.Type[result.size()]);
   }
 
   /**
@@ -204,7 +206,6 @@
   public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ,
                                                     AudioInputStream ais)
   {
-    HashSet result = new HashSet();
     Iterator i = 
ServiceFactory.lookupProviders(FormatConversionProvider.class);
     while (i.hasNext())
       {
@@ -228,7 +229,6 @@
   public static AudioInputStream getAudioInputStream(AudioFormat targ,
                                                     AudioInputStream ais)
   {
-    HashSet result = new HashSet();
     Iterator i = 
ServiceFactory.lookupProviders(FormatConversionProvider.class);
     while (i.hasNext())
       {
@@ -416,7 +416,7 @@
    */
   public static Mixer.Info[] getMixerInfo()
   {
-    HashSet result = new HashSet();
+    HashSet<Mixer.Info> result = new HashSet<Mixer.Info>();
     Iterator i = ServiceFactory.lookupProviders(MixerProvider.class);
     while (i.hasNext())
       {
@@ -425,7 +425,7 @@
         for (int j = 0; j < is.length; ++j)
           result.add(is[j]);
       }
-    return (Mixer.Info[]) result.toArray(new Mixer.Info[result.size()]);
+    return result.toArray(new Mixer.Info[result.size()]);
   }
 
   /**
@@ -474,7 +474,7 @@
    */
   public static Line.Info[] getSourceLineInfo(Line.Info info)
   {
-    HashSet result = new HashSet();
+    HashSet<Line.Info> result = new HashSet<Line.Info>();
     Mixer.Info[] infos = getMixerInfo();
     for (int i = 0; i < infos.length; ++i)
       {
@@ -483,7 +483,7 @@
         for (int j = 0; j < srcs.length; ++j)
           result.add(srcs[j]);
       }
-    return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+    return result.toArray(new Line.Info[result.size()]);
   }
 
   /**
@@ -534,7 +534,8 @@
    */
   public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding 
source)
   {
-    HashSet result = new HashSet();
+    HashSet<AudioFormat.Encoding> result
+      = new HashSet<AudioFormat.Encoding>();
     Iterator i = 
ServiceFactory.lookupProviders(FormatConversionProvider.class);
     while (i.hasNext())
       {
@@ -545,7 +546,7 @@
         for (int j = 0; j < es.length; ++j)
           result.add(es[j]);
       }
-    return (AudioFormat.Encoding[]) result.toArray(new 
AudioFormat.Encoding[result.size()]);
+    return result.toArray(new AudioFormat.Encoding[result.size()]);
   }
 
   /**
@@ -555,7 +556,8 @@
    */
   public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat source)
   {
-    HashSet result = new HashSet();
+    HashSet<AudioFormat.Encoding> result
+      = new HashSet<AudioFormat.Encoding>();
     Iterator i = 
ServiceFactory.lookupProviders(FormatConversionProvider.class);
     while (i.hasNext())
       {
@@ -564,7 +566,7 @@
         for (int j = 0; j < es.length; ++j)
           result.add(es[j]);
       }
-    return (AudioFormat.Encoding[]) result.toArray(new 
AudioFormat.Encoding[result.size()]);
+    return result.toArray(new AudioFormat.Encoding[result.size()]);
   }
 
   /**
@@ -576,7 +578,7 @@
   public static AudioFormat[] getTargetFormats(AudioFormat.Encoding encoding,
                                               AudioFormat sourceFmt)
   {
-    HashSet result = new HashSet();
+    HashSet<AudioFormat> result = new HashSet<AudioFormat>();
     Iterator i = 
ServiceFactory.lookupProviders(FormatConversionProvider.class);
     while (i.hasNext())
       {
@@ -585,7 +587,7 @@
         for (int j = 0; j < es.length; ++j)
           result.add(es[j]);
       }
-    return (AudioFormat[]) result.toArray(new AudioFormat[result.size()]);
+    return result.toArray(new AudioFormat[result.size()]);
   }
 
   /**
@@ -595,7 +597,7 @@
    */
   public static Line.Info[] getTargetLineInfo(Line.Info info)
   {
-    HashSet result = new HashSet();
+    HashSet<Line.Info> result = new HashSet<Line.Info>();
     Mixer.Info[] infos = getMixerInfo();
     for (int i = 0; i < infos.length; ++i)
       {
@@ -604,7 +606,7 @@
         for (int j = 0; j < targs.length; ++j)
           result.add(targs[j]);
       }
-    return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+    return result.toArray(new Line.Info[result.size()]);
   }
 
   /**
Index: javax/sound/sampled/BooleanControl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/sampled/BooleanControl.java,v
retrieving revision 1.2
diff -u -r1.2 BooleanControl.java
--- javax/sound/sampled/BooleanControl.java     16 Mar 2006 16:01:22 -0000      
1.2
+++ javax/sound/sampled/BooleanControl.java     17 Dec 2006 22:30:48 -0000
@@ -72,7 +72,6 @@
     }
   }
 
-  private Type type;
   private boolean value;
   private String trueLabel;
   private String falseLabel;

Reply via email to