classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] [generics] Patch: FYI: genericize java.text


From: Tom Tromey
Subject: [cp-patches] [generics] Patch: FYI: genericize java.text
Date: Fri, 25 Nov 2005 15:17:58 -0700

I'm checking this in on the generics branch.

This genericizes java.text.

Tom

2005-11-25  Tom Tromey  <address@hidden>

        * java/text/NumberFormat.java (format): No longer final.
        * java/text/AttributedCharacterIterator.java (getAllAttributeKeys):
        Genericized.
        (getAttributes): Likewise.
        (getRunLimit): Likewise.
        (getRunStart): Likewise.
        * java/text/AttributedString.java (AttributedString): Genericized.
        (addAttributes): Likewise.
        * java/text/Collator.java: Implement Comparator<Object>.

Index: java/text/AttributedCharacterIterator.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/java/text/AttributedCharacterIterator.java,v
retrieving revision 1.9.2.2
diff -u -r1.9.2.2 AttributedCharacterIterator.java
--- java/text/AttributedCharacterIterator.java  2 Aug 2005 20:12:26 -0000       
1.9.2.2
+++ java/text/AttributedCharacterIterator.java  25 Nov 2005 22:28:23 -0000
@@ -54,6 +54,7 @@
  * characters or which is undefined over a range of characters.
  *
  * @author Aaron M. Renn (address@hidden)
+ * @since 1.2
  */
 public interface AttributedCharacterIterator extends CharacterIterator
 {
@@ -192,7 +193,7 @@
    *
    * @return A list of keys 
    */
-  Set getAllAttributeKeys();
+  Set<Attribute> getAllAttributeKeys();
 
   /**
    * Returns a <code>Map</code> of the attributes defined for the current 
@@ -200,7 +201,7 @@
    *
    * @return A <code>Map</code> of the attributes for the current character.
    */
-  Map getAttributes();
+  Map<Attribute, Object> getAttributes();
 
   /**
    * Returns the value of the specified attribute for the
@@ -230,7 +231,7 @@
    *
    * @return The start index of the run.
    */
-  int getRunStart (Set attribs);
+  int getRunStart (Set<? extends Attribute> attribs);
   
   /**
    * Returns the index of the first character in the run that
@@ -259,7 +260,7 @@
    *
    * @return The end index of the run.
    */
-  int getRunLimit (Set attribs);
+  int getRunLimit (Set<? extends Attribute> attribs);
   
   /**
    * Returns the index of the character after the end of the run
Index: java/text/AttributedString.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/AttributedString.java,v
retrieving revision 1.8.2.4
diff -u -r1.8.2.4 AttributedString.java
--- java/text/AttributedString.java     2 Nov 2005 00:43:36 -0000       1.8.2.4
+++ java/text/AttributedString.java     25 Nov 2005 22:28:23 -0000
@@ -52,6 +52,7 @@
  * information via the <code>AttributedCharacterIterator</code> interface.
  *
  * @author Aaron M. Renn (address@hidden)
+ * @since 1.2
  */
 public class AttributedString
 {
@@ -116,7 +117,8 @@
    * @param str The <code>String</code> to be attributed.
    * @param attributes The attribute list.
    */
-  public AttributedString(String str, Map attributes)
+  public AttributedString(String str,
+                          Map<? extends AttributedCharacterIterator.Attribute, 
?> attributes)
   {
     this(str);
 
@@ -300,7 +302,8 @@
    *         <code>null</code>.
    * @throws IllegalArgumentException if the subrange is not valid.
    */
-  public void addAttributes(Map attributes, int begin_index, int end_index)
+  public void addAttributes(Map<? extends 
AttributedCharacterIterator.Attribute, ?> attributes,
+                            int begin_index, int end_index)
   {
     if (attributes == null)
       throw new NullPointerException("null attribute");
Index: java/text/Collator.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/Collator.java,v
retrieving revision 1.11.2.3
diff -u -r1.11.2.3 Collator.java
--- java/text/Collator.java     2 Aug 2005 20:12:26 -0000       1.11.2.3
+++ java/text/Collator.java     25 Nov 2005 22:28:24 -0000
@@ -72,7 +72,7 @@
  * API docs for JDK 1.2 from http://www.javasoft.com.
  * Status: Mostly complete, but parts stubbed out.  Look for FIXME.
  */
-public abstract class Collator implements Comparator, Cloneable
+public abstract class Collator implements Comparator<Object>, Cloneable
 {
   /**
    * This constant is a strength value which indicates that only primary
Index: java/text/NumberFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/NumberFormat.java,v
retrieving revision 1.12.2.3
diff -u -r1.12.2.3 NumberFormat.java
--- java/text/NumberFormat.java 2 Aug 2005 20:12:26 -0000       1.12.2.3
+++ java/text/NumberFormat.java 25 Nov 2005 22:28:24 -0000
@@ -222,8 +222,11 @@
     return sbuf.toString();
   }
 
-  public final StringBuffer format (Object obj, StringBuffer sbuf,
-                                   FieldPosition pos)
+  /**
+   * @specnote this method was final in releases before 1.5
+   */
+  public StringBuffer format (Object obj, StringBuffer sbuf,
+                              FieldPosition pos)
   {
     if (obj instanceof Number)
       return format(((Number) obj).doubleValue(), sbuf, pos);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]