classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] [generics] Patch: FYI: minor syntax fixes


From: Tom Tromey
Subject: [cp-patches] [generics] Patch: FYI: minor syntax fixes
Date: 08 Aug 2004 00:21:32 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

I'm checking this in on the generics branch.

I misremembered the syntax for generic methods, and gcjx reminded me
of it.  There's a couple other minor syntax errors in there too.
Also, this removes a use of `enum' -- I looked and upstream already
has a fix for this.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * external/jaxp/source/gnu/xml/aelfred2/XmlParser.java: Don't use
        `enum' keyword.

        * java/lang/Class.java, java/lang/Enum.java,
        java/lang/InheritableThreadLocal.java,
        java/util/AbstractCollection.java, java/util/Arrays.java,
        java/util/Collections.java, java/util/LinkedList.java,
        java/util/TreeSet.java, java/util/Vector.java: Fixed minor syntax
        errors.

Index: external/jaxp/source/gnu/xml/aelfred2/XmlParser.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/external/jaxp/source/gnu/xml/aelfred2/XmlParser.java,v
retrieving revision 1.2
diff -u -r1.2 XmlParser.java
--- external/jaxp/source/gnu/xml/aelfred2/XmlParser.java 1 May 2004 16:18:49 
-0000 1.2
+++ external/jaxp/source/gnu/xml/aelfred2/XmlParser.java 8 Aug 2004 06:35:15 
-0000
@@ -1500,7 +1500,7 @@
     {
        String name;
        String type;
-       String enum = null;
+       String enum_val = null;
 
        // Read the attribute name.
        name = readNmtoken (true);
@@ -1511,11 +1511,11 @@
 
        // Get the string of enumerated values if necessary.
        if ("ENUMERATION" == type || "NOTATION" == type)
-           enum = dataBufferToString ();
+           enum_val = dataBufferToString ();
 
        // Read the default value.
        requireWhitespace ();
-       parseDefault (elementName, name, type, enum);
+       parseDefault (elementName, name, type, enum_val);
     }
 
 
@@ -1612,7 +1612,7 @@
        String elementName,
        String name,
        String type,
-       String enum
+       String enum_val
     ) throws Exception
     {
        int     valueType = ATTRIBUTE_DEFAULT_SPECIFIED;
@@ -1650,11 +1650,11 @@
        } else
            value = readLiteral (flags);
        expandPE = saved;
-       setAttribute (elementName, name, type, enum, value, valueType);
+       setAttribute (elementName, name, type, enum_val, value, valueType);
        if ("ENUMERATION" == type)
-           type = enum;
+           type = enum_val;
        else if ("NOTATION" == type)
-           type = "NOTATION " + enum;
+           type = "NOTATION " + enum_val;
        if (!skippedPE) handler.getDeclHandler ()
            .attributeDecl (elementName, name, type, defaultType, value);
     }
Index: java/lang/Class.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v
retrieving revision 1.22.2.2
diff -u -r1.22.2.2 Class.java
--- java/lang/Class.java 7 Aug 2004 18:26:34 -0000 1.22.2.2
+++ java/lang/Class.java 8 Aug 2004 06:35:17 -0000
@@ -1247,7 +1247,7 @@
    * FIXME
    * @since 1.5
    */
-  <T> public Class<? extends T> asSubclass(Class<T> klass)
+  public <T> Class<? extends T> asSubclass(Class<T> klass)
   {
     if (! klass.isAssignableFrom(this))
       throw new ClassCastException();
Index: java/lang/Enum.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Attic/Enum.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 Enum.java
--- java/lang/Enum.java 7 Aug 2004 20:07:55 -0000 1.1.2.1
+++ java/lang/Enum.java 8 Aug 2004 06:35:17 -0000
@@ -52,7 +52,7 @@
     this.ordinal = ordinal;
   }
 
-  <S extends Enum<S>> public static Enum valueOf(Class<S> etype, String s)
+  public static <S extends Enum<S>> Enum valueOf(Class<S> etype, String s)
   {
     if (etype == null || s == null)
       throw new NullPointerException();
Index: java/lang/InheritableThreadLocal.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/InheritableThreadLocal.java,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 InheritableThreadLocal.java
--- java/lang/InheritableThreadLocal.java 7 Aug 2004 00:27:06 -0000 1.7.2.1
+++ java/lang/InheritableThreadLocal.java 8 Aug 2004 06:35:17 -0000
@@ -69,7 +69,8 @@
    * List can be collected, too. Maps to a list in case the user overrides
    * equals.
    */
-  private static final Map threadMap<Thread, 
ArrayList<InheritableThreadLocals<T>>>
+  private static final
+  Map<Thread, ArrayList<InheritableThreadLocals<T>>> threadMap
     = Collections.synchronizedMap(new WeakHashMap<Thread, 
ArrayList<InheritableThreadLocals<T>>>());
 
   /**
Index: java/util/AbstractCollection.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/AbstractCollection.java,v
retrieving revision 1.14.2.1
diff -u -r1.14.2.1 AbstractCollection.java
--- java/util/AbstractCollection.java 5 Aug 2004 21:09:36 -0000 1.14.2.1
+++ java/util/AbstractCollection.java 8 Aug 2004 06:35:17 -0000
@@ -395,7 +395,7 @@
    * @throws ArrayStoreException if the type of the array precludes holding
    *         one of the elements of the Collection
    */
-  <T> public T[] toArray(T[] a)
+  public <T> T[] toArray(T[] a)
   {
     int size = size();
     if (a.length < size)
Index: java/util/Arrays.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Arrays.java,v
retrieving revision 1.20.2.1
diff -u -r1.20.2.1 Arrays.java
--- java/util/Arrays.java 5 Aug 2004 21:09:36 -0000 1.20.2.1
+++ java/util/Arrays.java 8 Aug 2004 06:35:17 -0000
@@ -361,8 +361,7 @@
    * @throws NullPointerException if a null element is compared with natural
    *         ordering (only possible when c is null)
    */
-  // FIXME why "super"?
-  <T> public static int binarySearch(T[] a, T key, Comparator<? super T> c)
+  public static <T> int binarySearch(T[] a, T key, Comparator<? super T> c)
   {
     int low = 0;
     int hi = a.length - 1;
@@ -2332,7 +2331,7 @@
    * @see RandomAccess
    * @see Arrays.ArrayList
    */
-  <T> public static List<T> asList(final Object[] a) // fixme `T...'
+  public static <T> List<T> asList(final Object[] a) // fixme `T...'
   {
     return new Arrays.ArrayList(a);
   }
Index: java/util/Collections.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Collections.java,v
retrieving revision 1.28.2.1
diff -u -r1.28.2.1 Collections.java
--- java/util/Collections.java 5 Aug 2004 21:09:36 -0000 1.28.2.1
+++ java/util/Collections.java 8 Aug 2004 06:35:18 -0000
@@ -530,8 +530,8 @@
    * @throws NullPointerException if a null element has compareTo called
    * @see #sort(List)
    */
-  <T extends Object & Comparable<? super T>>
-  public static int binarySearch(List<? extends T> l, T key)
+  public static <T extends Object & Comparable<? super T>>
+               int binarySearch(List<? extends T> l, T key)
   {
     return binarySearch(l, key, null);
   }
@@ -563,7 +563,7 @@
    *         ordering (only possible when c is null)
    * @see #sort(List, Comparator)
    */
-  <T> public static int binarySearch(List<T> l, T key, Comparator<? super T> c)
+  public static <T> int binarySearch(List<T> l, T key, Comparator<? super T> c)
   {
     int pos = 0;
     int low = 0;
@@ -624,7 +624,7 @@
    * @throws UnsupportedOperationException if dest.listIterator() does not
    *         support the set operation
    */
-  <T> public static void copy(List<T> dest, List<T> source)
+  public static <T> void copy(List<T> dest, List<T> source)
   {
     int pos = source.size();
     if (dest.size() < pos)
@@ -647,7 +647,7 @@
    * @param c the Collection to iterate over
    * @return an Enumeration backed by an Iterator over c
    */
-  <T> public static Enumeration<T> enumeration(Collection<T> c)
+  public static <T> Enumeration<T> enumeration(Collection<T> c)
   {
     final Iterator<T> i = c.iterator();
     return new Enumeration<T>()
@@ -672,7 +672,7 @@
    * @throws UnsupportedOperationException if l.listIterator() does not
    *         support the set operation.
    */
-  <T> public static void fill(List<T> l, T val)
+  public static <T> void fill(List<T> l, T val)
   {
     ListIterator<T> itr = l.listIterator();
     for (int i = l.size() - 1; i >= 0; --i)
@@ -736,7 +736,7 @@
    * @see ArrayList
    * @since 1.4
    */
-  <T> public static ArrayList<T> list(Enumeration<T> e)
+  public static <T> ArrayList<T> list(Enumeration<T> e)
   {
     ArrayList<T> l = new ArrayList<T>();
     while (e.hasMoreElements())
@@ -755,8 +755,8 @@
    * @exception ClassCastException if elements in c are not mutually comparable
    * @exception NullPointerException if null.compareTo is called
    */
-  <T extends Object & Comparable<? super T>>
-  public static T max(Collection<? extends T> c)
+  public static <T extends Object & Comparable<? super T>>
+  T max(Collection<? extends T> c)
   {
     return max(c, null);
   }
@@ -775,7 +775,7 @@
    * @throws NullPointerException if null is compared by natural ordering
    *        (only possible when order is null)
    */
-  <T> public static T max(Collection<? extends T> c,
+  public static <T> T max(Collection<? extends T> c,
                          Comparator<? super T> order)
   {
     Iterator<? extends T> itr = c.iterator();
@@ -801,8 +801,8 @@
    * @throws ClassCastException if elements in c are not mutually comparable
    * @throws NullPointerException if null.compareTo is called
    */
-  <T extends Object & Comparable<? super T>>
-  public static T min(Collection<? extends T> c)
+  public static <T extends Object & Comparable<? super T>>
+  T min(Collection<? extends T> c)
   {
     return min(c, null);
   }
@@ -821,7 +821,7 @@
    * @throws NullPointerException if null is compared by natural ordering
    *        (only possible when order is null)
    */
-  <T> public static T min(Collection<? extends T> c,
+  public static <T> T min(Collection<? extends T> c,
                          Comparator<? super T> order)
   {
     Iterator<T> itr = c.iterator();
@@ -851,7 +851,7 @@
    * @see Serializable
    * @see RandomAccess
    */
-  <T> public static List<T> nCopies(final int n, final T o)
+  public static <T> List<T> nCopies(final int n, final T o)
   {
     return new CopiesList<T>(n, o);
   }
@@ -991,7 +991,7 @@
    *         it being added to the list
    * @since 1.4
    */
-  <T> public static boolean replaceAll(List<T> list, T oldval, T newval)
+  public static <T> boolean replaceAll(List<T> list, T oldval, T newval)
   {
     ListIterator<T> itr = list.listIterator();
     boolean replace_occured = false;
@@ -1011,7 +1011,7 @@
    * @throws UnsupportedOperationException if l.listIterator() does not
    *         support the set operation
    */
-  <T> public static void reverse(List<T> l)
+  public static <T> void reverse(List<T> l)
   {
     ListIterator<T> i1 = l.listIterator();
     int pos1 = 1;
@@ -1038,7 +1038,7 @@
    * @see Comparable
    * @see Serializable
    */
-  <T>public static Comparator<T> reverseOrder<T>()
+  public static <T> Comparator<T> reverseOrder<T>()
   {
     return (Comparator<T>) rcInstance; // fixme?
   }
@@ -1256,7 +1256,7 @@
    * @return an immutable Set containing only o
    * @see Serializable
    */
-  <T> public static Set<T> singleton(T o)
+  public static <T> Set<T> singleton(T o)
   {
     return new SingletonSet<T>(o);
   }
@@ -1389,7 +1389,7 @@
    * @see RandomAccess
    * @since 1.3
    */
-  <T> public static List<T> singletonList(T o)
+  public static <T> List<T> singletonList(T o)
   {
     return new SingletonList<T>(o);
   }
@@ -1529,7 +1529,7 @@
    * @see Serializable
    * @since 1.3
    */
-  <K, V> public static Map<K, V> singletonMap(K key, V value)
+  public static <K, V> Map<K, V> singletonMap(K key, V value)
   {
     return new SingletonMap<K, V>(key, value);
   }
@@ -1678,7 +1678,7 @@
    * @throws NullPointerException if some element is null
    * @see Arrays#sort(Object[])
    */
-  <T extends Comparable<? super T>> public static void sort(List<T> l)
+  public static <T extends Comparable<? super T>> void sort(List<T> l)
   {
     sort(l, null);
   }
@@ -1700,7 +1700,7 @@
    *        (only possible when c is null)
    * @see Arrays#sort(Object[], Comparator)
    */
-  <T> public static void sort(List<T> l, Comparator<? super T> c)
+  public static <T> void sort(List<T> l, Comparator<? super T> c)
   {
     Object[] a = l.toArray();
     Arrays.sort(a, c);
@@ -1757,7 +1757,7 @@
    * @return a synchronized view of the collection
    * @see Serializable
    */
-  <T> public static Collection<T> synchronizedCollection(Collection<T> c)
+  public static <T> Collection<T> synchronizedCollection(Collection<T> c)
   {
     return new SynchronizedCollection<T>(c);
   }
@@ -1913,7 +1913,7 @@
         }
     }
 
-    <T> public T[] toArray(T[] a)
+    public <T> T[] toArray(T[] a)
     {
       synchronized (mutex)
         {
@@ -2011,7 +2011,7 @@
    * @see Serializable
    * @see RandomAccess
    */
-  <T> public static List<T> synchronizedList(List<T> l)
+  public static <T> List<T> synchronizedList(List<T> l)
   {
     if (l instanceof RandomAccess)
       return new SynchronizedRandomAccessList<T>(l);
@@ -2307,7 +2307,7 @@
    * @return a synchronized view of the map
    * @see Serializable
    */
-  <K, V> public static Map<K, V> synchronizedMap(Map<K, V> m)
+  public static <K, V> Map<K, V> synchronizedMap(Map<K, V> m)
   {
     return new SynchronizedMap<K, V>(m);
   }
@@ -2606,7 +2606,7 @@
    * @return a synchronized view of the set
    * @see Serializable
    */
-  <T> public static Set<T> synchronizedSet(Set<T> s)
+  public static <T> Set<T> synchronizedSet(Set<T> s)
   {
     return new SynchronizedSet<T>(s);
   }
@@ -2694,7 +2694,7 @@
    * @return a synchronized view of the sorted map
    * @see Serializable
    */
-  <K, V> public static SortedMap<K, V> synchronizedSortedMap(SortedMap<K, V> m)
+  public static <K, V> SortedMap<K, V> synchronizedSortedMap(SortedMap<K, V> m)
   {
     return new SynchronizedSortedMap<K, V>(m);
   }
@@ -2936,7 +2936,7 @@
    * @return a read-only view of the collection
    * @see Serializable
    */
-  <T> public static Collection<T> unmodifiableCollection(Collection<T> c)
+  public static <T> Collection<T> unmodifiableCollection(Collection<T> c)
   {
     return new UnmodifiableCollection<T>(c);
   }
@@ -3033,7 +3033,7 @@
       return c.toArray();
     }
 
-    <S> public S[] toArray(S[] a)
+    public <S> S[] toArray(S[] a)
     {
       return c.toArray(a);
     }
@@ -3098,7 +3098,7 @@
    * @see Serializable
    * @see RandomAccess
    */
-  <T> public static List<T> unmodifiableList(List<T> l)
+  public static <T> List<T> unmodifiableList(List<T> l)
   {
     if (l instanceof RandomAccess)
       return new UnmodifiableRandomAccessList<T>(l);
@@ -3295,7 +3295,7 @@
    * @return a read-only view of the map
    * @see Serializable
    */
-  <K, V> public static Map<K, V> unmodifiableMap(Map<K, V> m)
+  public static <K, V> Map<K, V> unmodifiableMap(Map<K, V> m)
   {
     return new UnmodifiableMap<K, V>(m);
   }
@@ -3507,7 +3507,7 @@
    * @return a read-only view of the set
    * @see Serializable
    */
-  <T> public static Set<T> unmodifiableSet(Set<T> s)
+  public static <T> Set<T> unmodifiableSet(Set<T> s)
   {
     return new UnmodifiableSet<T>(s);
   }
@@ -3561,7 +3561,7 @@
    * @return a read-only view of the map
    * @see Serializable
    */
-  <K, V> public static SortedMap<K, V> unmodifiableSortedMap(SortedMap<K, V> m)
+  public static <K, V> SortedMap<K, V> unmodifiableSortedMap(SortedMap<K, V> m)
   {
     return new UnmodifiableSortedMap<K, V>(m);
   }
@@ -3644,7 +3644,7 @@
    * @return a read-only view of the set
    * @see Serializable
    */
-  <T> public static SortedSet<T> unmodifiableSortedSet(SortedSet<T> s)
+  public static <T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> s)
   {
     return new UnmodifiableSortedSet<T>(s);
   }
Index: java/util/LinkedList.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/LinkedList.java,v
retrieving revision 1.23.2.2
diff -u -r1.23.2.2 LinkedList.java
--- java/util/LinkedList.java 7 Aug 2004 20:31:55 -0000 1.23.2.2
+++ java/util/LinkedList.java 8 Aug 2004 06:35:18 -0000
@@ -692,7 +692,7 @@
    *         an element in this list
    * @throws NullPointerException if a is null
    */
-  <S> public S[] toArray(S[] a)
+  public <S> S[] toArray(S[] a)
   {
     if (a.length < size)
       a = (S[]) Array.newInstance(a.getClass().getComponentType(), size);
Index: java/util/TreeSet.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/TreeSet.java,v
retrieving revision 1.15.2.1
diff -u -r1.15.2.1 TreeSet.java
--- java/util/TreeSet.java 5 Aug 2004 21:09:36 -0000 1.15.2.1
+++ java/util/TreeSet.java 8 Aug 2004 06:35:18 -0000
@@ -213,7 +213,7 @@
     TreeSet<T> copy = null;
     try
       {
-        copy = (TreeSet,T>) super.clone();
+        copy = (TreeSet<T>) super.clone();
         // Map may be either TreeMap or TreeMap.SubMap, hence the ugly casts.
         copy.map = (SortedMap<T>) ((AbstractMap<T>) map).clone();
       }
Index: java/util/Vector.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Vector.java,v
retrieving revision 1.20.2.1
diff -u -r1.20.2.1 Vector.java
--- java/util/Vector.java 5 Aug 2004 21:09:36 -0000 1.20.2.1
+++ java/util/Vector.java 8 Aug 2004 06:35:19 -0000
@@ -566,7 +566,7 @@
    * @throws NullPointerException if <code>a</code> is null
    * @since 1.2
    */
-  <S> public synchronized S[] toArray(S[] a)
+  public synchronized <S> S[] toArray(S[] a)
   {
     if (a.length < elementCount)
       a = (S[]) Array.newInstance(a.getClass().getComponentType(),




reply via email to

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