[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] [generics] Patch: FYI: generics -vs- java.nio
From: |
Tom Tromey |
Subject: |
[cp-patches] [generics] Patch: FYI: generics -vs- java.nio |
Date: |
27 Sep 2005 10:49:54 -0600 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
I'm checking this in on the generics branch.
This genericizes some types in java.nio.
Tom
Index: ChangeLog
from Tom Tromey <address@hidden>
* java/nio/charset/spi/CharsetProvider.java (charsets): Changed
return type.
* java/nio/charset/Charset.java (aliases): Changed return type.
(availableCharsets): Likewise.
* java/nio/channels/spi/AbstractSelector.java (cancelledKeys):
Changed type.
(AbstractSelector): Updated.
(cancelledKeys): Updated.
Index: java/nio/channels/spi/AbstractSelector.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/java/nio/channels/spi/AbstractSelector.java,v
retrieving revision 1.10.2.1
diff -u -r1.10.2.1 AbstractSelector.java
--- java/nio/channels/spi/AbstractSelector.java 2 Aug 2005 20:12:24 -0000
1.10.2.1
+++ java/nio/channels/spi/AbstractSelector.java 27 Sep 2005 16:41:38 -0000
@@ -1,5 +1,5 @@
/* AbstractSelector.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@
{
private boolean closed;
private SelectorProvider provider;
- private HashSet cancelledKeys;
+ private HashSet<SelectionKey> cancelledKeys;
/**
* Initializes the slector.
@@ -59,7 +59,7 @@
protected AbstractSelector(SelectorProvider provider)
{
this.provider = provider;
- this.cancelledKeys = new HashSet();
+ this.cancelledKeys = new HashSet<SelectionKey>();
}
/**
@@ -115,7 +115,7 @@
*
* @return the cancelled keys set
*/
- protected final Set cancelledKeys()
+ protected final Set<SelectionKey> cancelledKeys()
{
if (! isOpen())
throw new ClosedSelectorException();
Index: java/nio/charset/Charset.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/charset/Charset.java,v
retrieving revision 1.11.2.10
diff -u -r1.11.2.10 Charset.java
--- java/nio/charset/Charset.java 20 Sep 2005 18:46:29 -0000 1.11.2.10
+++ java/nio/charset/Charset.java 27 Sep 2005 16:41:38 -0000
@@ -217,19 +217,20 @@
return cs;
}
- public static SortedMap availableCharsets()
+ public static SortedMap<String, Charset> availableCharsets()
{
- TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER);
- for (Iterator i = provider().charsets(); i.hasNext(); )
+ TreeMap<String, Charset> charsets
+ = new TreeMap(String.CASE_INSENSITIVE_ORDER);
+ for (Iterator<Charset> i = provider().charsets(); i.hasNext(); )
{
- Charset cs = (Charset) i.next();
+ Charset cs = i.next();
charsets.put(cs.name(), cs);
}
CharsetProvider[] providers = providers2();
for (int j = 0; j < providers.length; j++)
{
- for (Iterator i = providers[j].charsets(); i.hasNext(); )
+ for (Iterator<Charset> i = providers[j].charsets(); i.hasNext(); )
{
Charset cs = (Charset) i.next();
charsets.put(cs.name(), cs);
@@ -282,14 +283,14 @@
return canonicalName;
}
- public final Set aliases ()
+ public final Set<String> aliases ()
{
if (aliases == null)
- return Collections.EMPTY_SET;
+ return Collections.<String>emptySet();
// should we cache the aliasSet instead?
int n = aliases.length;
- HashSet aliasSet = new HashSet (n);
+ HashSet<String> aliasSet = new HashSet<String> (n);
for (int i = 0; i < n; ++i)
aliasSet.add (aliases[i]);
return Collections.unmodifiableSet (aliasSet);
Index: java/nio/charset/spi/CharsetProvider.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/java/nio/charset/spi/CharsetProvider.java,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 CharsetProvider.java
--- java/nio/charset/spi/CharsetProvider.java 2 Aug 2005 20:12:24 -0000 1.2.2.2
+++ java/nio/charset/spi/CharsetProvider.java 27 Sep 2005 16:41:38 -0000
@@ -1,5 +1,5 @@
/* CharsetProvider.java -- charset service provider interface
- Copyright (C) 2002 Free Software Foundation
+ Copyright (C) 2002, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -78,7 +78,7 @@
* @return the iterator
* @see Charset#availableCharsets()
*/
- public abstract Iterator charsets();
+ public abstract Iterator<Charset> charsets();
/**
* Returns the named charset, by canonical name or alias.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] [generics] Patch: FYI: generics -vs- java.nio,
Tom Tromey <=