Merged gcj-eclipse branch to trunk.

From-SVN: r120621
This commit is contained in:
Tom Tromey
2007-01-09 19:58:05 +00:00
parent c648dedbde
commit 97b8365caf
17478 changed files with 606493 additions and 100744 deletions
+4 -6
View File
@@ -1,5 +1,5 @@
/* ByteBuffer.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.
@@ -42,7 +42,7 @@ package java.nio;
* @since 1.4
*/
public abstract class ByteBuffer extends Buffer
implements Comparable
implements Comparable<ByteBuffer>
{
ByteOrder endian = ByteOrder.BIG_ENDIAN;
@@ -290,7 +290,7 @@ public abstract class ByteBuffer extends Buffer
{
if (obj instanceof ByteBuffer)
{
return compareTo (obj) == 0;
return compareTo ((ByteBuffer) obj) == 0;
}
return false;
@@ -302,10 +302,8 @@ public abstract class ByteBuffer extends Buffer
* @exception ClassCastException If obj is not an object derived from
* <code>ByteBuffer</code>.
*/
public int compareTo (Object obj)
public int compareTo (ByteBuffer other)
{
ByteBuffer other = (ByteBuffer) obj;
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
+39 -6
View File
@@ -1,5 +1,5 @@
/* CharBuffer.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.
@@ -38,11 +38,13 @@ exception statement from your version. */
package java.nio;
import java.io.IOException;
/**
* @since 1.4
*/
public abstract class CharBuffer extends Buffer
implements Comparable, CharSequence
implements Comparable<CharBuffer>, CharSequence, Readable, Appendable
{
int array_offset;
char[] backing_buffer;
@@ -163,6 +165,18 @@ public abstract class CharBuffer extends Buffer
return this;
}
/** @since 1.5 */
public int read(CharBuffer buffer) throws IOException
{
// We want to call put(), so we don't manipulate the CharBuffer
// directly.
int rem = Math.min(buffer.remaining(), remaining());
char[] buf = new char[rem];
get(buf);
buffer.put(buf);
return rem;
}
/**
* This method transfers <code>char</code>s from this buffer into the given
* destination array.
@@ -323,7 +337,7 @@ public abstract class CharBuffer extends Buffer
{
if (obj instanceof CharBuffer)
{
return compareTo (obj) == 0;
return compareTo ((CharBuffer) obj) == 0;
}
return false;
@@ -335,10 +349,8 @@ public abstract class CharBuffer extends Buffer
* @exception ClassCastException If obj is not an object derived from
* <code>CharBuffer</code>.
*/
public int compareTo (Object obj)
public int compareTo (CharBuffer other)
{
CharBuffer other = (CharBuffer) obj;
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
@@ -503,4 +515,25 @@ public abstract class CharBuffer extends Buffer
return get (position () + index);
}
/** @since 1.5 */
public CharBuffer append(char c)
{
put(c);
return this;
}
/** @since 1.5 */
public CharBuffer append(CharSequence cs)
{
put(cs == null ? "null" : cs.toString());
return this;
}
/** @since 1.5 */
public CharBuffer append(CharSequence cs, int start, int end)
{
put(cs == null ? "null" : cs.subSequence(start, end).toString());
return this;
}
}
@@ -233,7 +233,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
int pos = position();
if (this.mark != -1)
reset();
reset();
int mark = position();
position(pos);
DirectByteBufferImpl result;
+4 -6
View File
@@ -1,5 +1,5 @@
/* DoubleBuffer.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.
@@ -42,7 +42,7 @@ package java.nio;
* @since 1.4
*/
public abstract class DoubleBuffer extends Buffer
implements Comparable
implements Comparable<DoubleBuffer>
{
int array_offset;
double[] backing_buffer;
@@ -273,7 +273,7 @@ public abstract class DoubleBuffer extends Buffer
{
if (obj instanceof DoubleBuffer)
{
return compareTo (obj) == 0;
return compareTo ((DoubleBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@ public abstract class DoubleBuffer extends Buffer
* @exception ClassCastException If obj is not an object derived from
* <code>DoubleBuffer</code>.
*/
public int compareTo (Object obj)
public int compareTo (DoubleBuffer other)
{
DoubleBuffer other = (DoubleBuffer) obj;
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
+4 -6
View File
@@ -1,5 +1,5 @@
/* FloatBuffer.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.
@@ -42,7 +42,7 @@ package java.nio;
* @since 1.4
*/
public abstract class FloatBuffer extends Buffer
implements Comparable
implements Comparable<FloatBuffer>
{
int array_offset;
float[] backing_buffer;
@@ -273,7 +273,7 @@ public abstract class FloatBuffer extends Buffer
{
if (obj instanceof FloatBuffer)
{
return compareTo (obj) == 0;
return compareTo ((FloatBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@ public abstract class FloatBuffer extends Buffer
* @exception ClassCastException If obj is not an object derived from
* <code>FloatBuffer</code>.
*/
public int compareTo (Object obj)
public int compareTo (FloatBuffer other)
{
FloatBuffer other = (FloatBuffer) obj;
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
+4 -6
View File
@@ -1,5 +1,5 @@
/* IntBuffer.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.
@@ -42,7 +42,7 @@ package java.nio;
* @since 1.4
*/
public abstract class IntBuffer extends Buffer
implements Comparable
implements Comparable<IntBuffer>
{
int array_offset;
int[] backing_buffer;
@@ -273,7 +273,7 @@ public abstract class IntBuffer extends Buffer
{
if (obj instanceof IntBuffer)
{
return compareTo (obj) == 0;
return compareTo ((IntBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@ public abstract class IntBuffer extends Buffer
* @exception ClassCastException If obj is not an object derived from
* <code>IntBuffer</code>.
*/
public int compareTo (Object obj)
public int compareTo (IntBuffer other)
{
IntBuffer other = (IntBuffer) obj;
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
+4 -6
View File
@@ -1,5 +1,5 @@
/* LongBuffer.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.
@@ -42,7 +42,7 @@ package java.nio;
* @since 1.4
*/
public abstract class LongBuffer extends Buffer
implements Comparable
implements Comparable<LongBuffer>
{
int array_offset;
long[] backing_buffer;
@@ -273,7 +273,7 @@ public abstract class LongBuffer extends Buffer
{
if (obj instanceof LongBuffer)
{
return compareTo (obj) == 0;
return compareTo ((LongBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@ public abstract class LongBuffer extends Buffer
* @exception ClassCastException If obj is not an object derived from
* <code>LongBuffer</code>.
*/
public int compareTo (Object obj)
public int compareTo (LongBuffer other)
{
LongBuffer other = (LongBuffer) obj;
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
+4 -6
View File
@@ -1,5 +1,5 @@
/* ShortBuffer.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.
@@ -42,7 +42,7 @@ package java.nio;
* @since 1.4
*/
public abstract class ShortBuffer extends Buffer
implements Comparable
implements Comparable<ShortBuffer>
{
int array_offset;
short[] backing_buffer;
@@ -273,7 +273,7 @@ public abstract class ShortBuffer extends Buffer
{
if (obj instanceof ShortBuffer)
{
return compareTo (obj) == 0;
return compareTo ((ShortBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@ public abstract class ShortBuffer extends Buffer
* @exception ClassCastException If obj is not an object derived from
* <code>ShortBuffer</code>.
*/
public int compareTo (Object obj)
public int compareTo (ShortBuffer other)
{
ShortBuffer other = (ShortBuffer) obj;
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
@@ -1,5 +1,5 @@
/* Channel.java --
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,9 @@ exception statement from your version. */
package java.nio.channels;
import java.io.IOException;
import java.io.Closeable;
public interface Channel
public interface Channel extends Closeable
{
/**
* Tells whether this channel is open or not
@@ -82,7 +82,7 @@ public abstract class Selector
*
* @exception ClosedSelectorException If this selector is closed.
*/
public abstract Set keys();
public abstract Set<SelectionKey> keys();
/**
* Returns the SelectorProvider that created the selector.
@@ -115,7 +115,7 @@ public abstract class Selector
*
* @exception ClosedSelectorException If this selector is closed.
*/
public abstract Set selectedKeys();
public abstract Set<SelectionKey> selectedKeys();
/**
* Selects a set of keys whose corresponding channels are ready
@@ -44,6 +44,7 @@ import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.IllegalBlockingModeException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
@@ -106,7 +107,15 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
*/
protected final void implCloseChannel() throws IOException
{
implCloseSelectableChannel();
try
{
implCloseSelectableChannel();
}
finally
{
for (Iterator it = keys.iterator(); it.hasNext(); )
((SelectionKey) it.next()).cancel();
}
}
/**
@@ -234,8 +243,8 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
if (key != null && key.isValid())
{
if (att != null)
key.attach(att);
key.interestOps(ops);
key.attach(att);
}
else
{
@@ -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 @@ public abstract class AbstractSelector extends Selector
{
private boolean closed;
private SelectorProvider provider;
private HashSet cancelledKeys;
private HashSet<SelectionKey> cancelledKeys;
/**
* Initializes the slector.
@@ -59,7 +59,7 @@ public abstract class AbstractSelector extends Selector
protected AbstractSelector(SelectorProvider provider)
{
this.provider = provider;
this.cancelledKeys = new HashSet();
this.cancelledKeys = new HashSet<SelectionKey>();
}
/**
@@ -115,7 +115,7 @@ public abstract class AbstractSelector extends Selector
*
* @return the cancelled keys set
*/
protected final Set cancelledKeys()
protected final Set<SelectionKey> cancelledKeys()
{
if (! isOpen())
throw new ClosedSelectorException();
+12 -11
View File
@@ -60,7 +60,7 @@ import java.util.TreeMap;
* @since 1.4
* @status updated to 1.5
*/
public abstract class Charset implements Comparable
public abstract class Charset implements Comparable<Charset>
{
private CharsetEncoder cachedEncoder;
private CharsetDecoder cachedDecoder;
@@ -219,19 +219,20 @@ public abstract class Charset implements Comparable
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);
@@ -284,14 +285,14 @@ public abstract class Charset implements Comparable
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);
@@ -376,9 +377,9 @@ public abstract class Charset implements Comparable
}
}
public final int compareTo (Object ob)
public final int compareTo (Charset other)
{
return canonicalName.compareToIgnoreCase (((Charset) ob).canonicalName);
return canonicalName.compareToIgnoreCase (other.canonicalName);
}
public final int hashCode ()
@@ -1,5 +1,5 @@
/* CharsetProvider.java -- charset service provider interface
Copyright (C) 2002, 2006 Free Software Foundation
Copyright (C) 2002, 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -82,7 +82,7 @@ public abstract class CharsetProvider
* @return the iterator
* @see Charset#availableCharsets()
*/
public abstract Iterator charsets();
public abstract Iterator<Charset> charsets();
/**
* Returns the named charset, by canonical name or alias.
@@ -0,0 +1,58 @@
# This property file contains dependencies of classes, methods, and
# field on other methods or classes.
#
# Syntax:
#
# <used>: <needed 1> [... <needed N>]
#
# means that when <used> is included, <needed 1> (... <needed N>) must
# be included as well.
#
# <needed X> and <used> are of the form
#
# <class.methodOrField(signature)>
#
# or just
#
# <class>
#
# Within dependencies, variables can be used. A variable is defined as
# follows:
#
# {variable}: value1 value2 ... value<n>
#
# variables can be used on the right side of dependencies as follows:
#
# <used>: com.bla.blu.{variable}.Class.m()V
#
# The use of the variable will expand to <n> dependencies of the form
#
# <used>: com.bla.blu.value1.Class.m()V
# <used>: com.bla.blu.value2.Class.m()V
# ...
# <used>: com.bla.blu.value<n>.Class.m()V
#
# Variables can be redefined when building a system to select the
# required support for features like encodings, protocols, etc.
#
# Hints:
#
# - For methods and fields, the signature is mandatory. For
# specification, please see the Java Virtual Machine Specification by
# SUN. Unlike in the spec, field signatures (types) are in brackets.
#
# - Package names must be separated by '/' (and not '.'). E.g.,
# java/lang/Class (this is necessary, because the '.' is used to
# separate method or field names from classes)
#
# - In case <needed> refers to a class, only the class itself will be
# included in the resulting binary, NOT necessarily all its methods
# and fields. If you want to refer to all methods and fields, you can
# write class.* as an abbreviation.
#
# - Abbreviations for packages are also possible: my/package/* means all
# methods and fields of all classes in my/package.
#
# - A line with a trailing '\' continues in the next line.
# end of file