Import GNU Classpath (libgcj-import-20070727).

libjava/

2007-08-04  Matthias Klose  <doko@ubuntu.com>

	Import GNU Classpath (libgcj-import-20070727).

	* Regenerate class and header files.
	* Regenerate auto* files.

	* include/jvm.h:
	* jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type.
	* jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise.
	* jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA,
	_Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA,
	_Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA,
	_Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify
	jvalue parameter.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise.

	* java/lang/VMFloat.java (toString, parseFloat): New.

	* gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported,
	isModalExclusionTypeSupported): New (stub only).
	* gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise.
	* gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages,
	updateFocusableWindowState, setModalBlocked, getBoundsPrivate,
	setAlwaysOnTop): Likewise.
	* gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature.

	* scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer,
	ignore javax.sound.sampled.spi.MixerProvider, ignore .in files.

	* HACKING: Mention --enable-gstreamer-peer, removal of generated files.


libjava/classpath/

2007-08-04  Matthias Klose  <doko@ubuntu.com>

	* java/util/EnumMap.java (clone): Add cast.

From-SVN: r127204
This commit is contained in:
Matthias Klose 2007-08-04 10:53:49 +00:00
parent 2c3de459b6
commit f06a83c0b2
522 changed files with 13385 additions and 4867 deletions

View file

@ -93,7 +93,7 @@ public class AWTKeyStroke implements Serializable
private static final int MAX_CACHE_SIZE = 2048;
/** Prune stale entries. */
protected boolean removeEldestEntry(Entry<AWTKeyStroke,AWTKeyStroke>
protected boolean removeEldestEntry(Map.Entry<AWTKeyStroke,AWTKeyStroke>
eldest)
{
return size() > MAX_CACHE_SIZE;

View file

@ -61,7 +61,7 @@ public final class AlphaComposite implements Composite
private static final int MAX_CACHE_SIZE = 2048;
/** Prune stale entries. */
protected boolean removeEldestEntry(Entry eldest)
protected boolean removeEldestEntry(Map.Entry eldest)
{
return size() > MAX_CACHE_SIZE;
}

View file

@ -61,6 +61,21 @@ import javax.accessibility.AccessibleStateSet;
*/
public class Dialog extends Window
{
public enum ModalExclusionType
{
APPLICATION_EXCLUDE,
NO_EXCLUDE,
TOOLKIT_EXCLUDE
}
public enum ModalityType
{
APPLICATION_MODAL,
DOCUMENT_MODAL,
MODELESS,
TOOLKIT_MODAL
}
// Serialization constant
private static final long serialVersionUID = 5920926903803293709L;

View file

@ -169,6 +169,31 @@ public class Font implements Serializable
*/
public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
/**
* @since 1.6
*/
public static final String DIALOG = "Dialog";
/**
* @since 1.6
*/
public static final String DIALOG_INPUT = "DialogInput";
/**
* @since 1.6
*/
public static final String MONOSPACED = "Monospaced";
/**
* @since 1.6
*/
public static final String SANS_SERIF = "SansSerif";
/**
* @since 1.6
*/
public static final String SERIF = "Serif";
/**
* The logical name of this font.
*
@ -330,6 +355,11 @@ public class Font implements Serializable
return getFont(propname, (Font) null);
}
protected Font(Font font)
{
this(font.getName(), font.getAttributes());
}
/**
* Initializes a new instance of <code>Font</code> with the specified
* attributes.
@ -491,7 +521,12 @@ public class Font implements Serializable
*/
public boolean canDisplay(char c)
{
return peer.canDisplay(this, c);
return canDisplay((int) c);
}
public boolean canDisplay(int codePoint)
{
return peer.canDisplay(this, codePoint);
}
/**
@ -1373,6 +1408,12 @@ public class Font implements Serializable
return getLineMetrics(str, 0, str.length() - 1, frc);
}
public boolean hasLayoutAttributes()
{
// TODO: Implement properly.
return false;
}
/**
* Reads the normal fields from the stream and then constructs the
* peer from the style and size through getPeerFromToolkit().

View file

@ -1287,6 +1287,12 @@ public abstract class Toolkit
public abstract Map<TextAttribute,?>
mapInputMethodHighlight(InputMethodHighlight highlight);
public abstract boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType);
public abstract boolean isModalityTypeSupported
(Dialog.ModalityType modalityType);
/**
* Initializes the accessibility framework. In particular, this loads the
* properties javax.accessibility.screen_magnifier_present and

View file

@ -163,6 +163,16 @@ public class MouseEvent extends InputEvent
*/
private int y;
/**
* The screen position of that mouse event, X coordinate.
*/
private int absX;
/**
* The screen position of that mouse event, Y coordinate.
*/
private int absY;
/**
* The number of clicks that took place. For MOUSE_CLICKED, MOUSE_PRESSED,
* and MOUSE_RELEASED, this will be at least 1; otherwise it is 0.
@ -212,6 +222,7 @@ public class MouseEvent extends InputEvent
int button)
{
super(source, id, when, modifiers);
this.x = x;
this.y = y;
this.clickCount = clickCount;
@ -234,6 +245,13 @@ public class MouseEvent extends InputEvent
this.modifiersEx &= ~(BUTTON1_DOWN_MASK
| BUTTON2_DOWN_MASK
| BUTTON3_DOWN_MASK);
if (source != null)
{
Point screenLoc = source.getLocationOnScreen();
absX = screenLoc.x + x;
absY = screenLoc.y + y;
}
}
/**
@ -257,6 +275,59 @@ public class MouseEvent extends InputEvent
NOBUTTON);
}
/**
* Creates a new MouseEvent. This is like the other constructors and adds
* specific absolute coordinates.
*
* @param source the source of the event
* @param id the event id
* @param when the timestamp of when the event occurred
* @param modifiers the modifier keys during the event, in old or new style
* @param x the X coordinate of the mouse point
* @param y the Y coordinate of the mouse point
* @param absX the absolute X screen coordinate of this event
* @param absY the absolute Y screen coordinate of this event
* @param clickCount the number of mouse clicks for this event
* @param popupTrigger true if this event triggers a popup menu
* @param button the most recent mouse button to change state
*
* @throws IllegalArgumentException if source is null or button is invalid
*
* @since 1.6
*/
public MouseEvent(Component source, int id, long when, int modifiers,
int x, int y, int absX, int absY, int clickCount,
boolean popupTrigger, int button)
{
super(source, id, when, modifiers);
this.x = x;
this.y = y;
this.clickCount = clickCount;
this.popupTrigger = popupTrigger;
this.button = button;
if (button < NOBUTTON || button > BUTTON3)
throw new IllegalArgumentException();
if ((modifiers & EventModifier.OLD_MASK) != 0)
{
if ((modifiers & BUTTON1_MASK) != 0)
this.button = BUTTON1;
else if ((modifiers & BUTTON2_MASK) != 0)
this.button = BUTTON2;
else if ((modifiers & BUTTON3_MASK) != 0)
this.button = BUTTON3;
}
// clear the mouse button modifier masks if this is a button
// release event.
if (id == MOUSE_RELEASED)
this.modifiersEx &= ~(BUTTON1_DOWN_MASK
| BUTTON2_DOWN_MASK
| BUTTON3_DOWN_MASK);
this.absX = absX;
this.absY = absY;
}
/**
* This method returns the X coordinate of the mouse position. This is
* relative to the source component.
@ -279,6 +350,30 @@ public class MouseEvent extends InputEvent
return y;
}
/**
* @since 1.6
*/
public Point getLocationOnScreen()
{
return new Point(absX, absY);
}
/**
* @since 1.6
*/
public int getXOnScreen()
{
return absX;
}
/**
* @since 1.6
*/
public int getYOnScreen()
{
return absY;
}
/**
* This method returns a <code>Point</code> for the x,y position of
* the mouse pointer. This is relative to the source component.

View file

@ -59,6 +59,8 @@ import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage;
import sun.awt.CausedFocusEvent;
/**
* Defines the methods that a component peer is required to implement.
*/
@ -264,7 +266,7 @@ public interface ComponentPeer
/**
* Requests that this component receives the focus. This is called from
* {@link Component#requestFocus()}.
*
*
* @specnote Part of the earlier 1.1 API, apparently replaced by argument
* form of the same method.
*/
@ -518,4 +520,13 @@ public interface ComponentPeer
* @since 1.5
*/
void layout();
/**
* Requests the focus on the component.
*/
boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
CausedFocusEvent.Cause cause);
}

View file

@ -71,5 +71,8 @@ public interface FramePeer extends WindowPeer
* @since 1.5
*/
void setBoundsPrivate(int x, int y, int width, int height);
Rectangle getBoundsPrivate();
} // interface FramePeer

View file

@ -50,5 +50,7 @@ public interface RobotPeer
void keyRelease (int keycode);
int getRGBPixel (int x, int y);
int[] getRGBPixels (Rectangle screen);
void dispose();
} // interface RobotPeer

View file

@ -38,6 +38,8 @@ exception statement from your version. */
package java.awt.peer;
import java.awt.Dialog;
public interface WindowPeer extends ContainerPeer
{
void toBack();
@ -57,5 +59,12 @@ public interface WindowPeer extends ContainerPeer
* @since 1.5
*/
boolean requestWindowFocus();
void setAlwaysOnTop(boolean alwaysOnTop);
void updateFocusableWindowState();
void setModalBlocked(Dialog blocker, boolean blocked);
void updateMinimumSize();
void updateIconImages();
} // interface WindowPeer

View file

@ -799,6 +799,14 @@ outer:
result = cache.longValue();
else
{
// Note that we can't use Class.isEnum() here, because that returns
// false for java.lang.Enum and enum value sub classes.
if (Enum.class.isAssignableFrom(cl) || Proxy.isProxyClass(cl))
{
// Spec says that enums and dynamic proxies have
// a serialVersionUID of 0L.
return 0L;
}
try
{
result = getClassUIDFromField(cl);

View file

@ -181,7 +181,7 @@ public final class Float extends Number implements Comparable<Float>
*/
public static String toString(float f)
{
return VMDouble.toString(f, true);
return VMFloat.toString(f);
}
/**
@ -331,9 +331,9 @@ public final class Float extends Number implements Comparable<Float>
*
* @param str the <code>String</code> to convert
* @return the <code>float</code> value of <code>s</code>
* @throws NumberFormatException if <code>s</code> cannot be parsed as a
* @throws NumberFormatException if <code>str</code> cannot be parsed as a
* <code>float</code>
* @throws NullPointerException if <code>s</code> is null
* @throws NullPointerException if <code>str</code> is null
* @see #MIN_VALUE
* @see #MAX_VALUE
* @see #POSITIVE_INFINITY
@ -342,9 +342,7 @@ public final class Float extends Number implements Comparable<Float>
*/
public static float parseFloat(String str)
{
// XXX Rounding parseDouble() causes some errors greater than 1 ulp from
// the infinitely precise decimal.
return (float) Double.parseDouble(str);
return VMFloat.parseFloat(str);
}
/**

View file

@ -705,10 +705,13 @@ public final class Integer extends Number implements Comparable<Integer>
if (len == 0)
throw new NumberFormatException("string length is null");
int ch = str.charAt(index);
if (ch == '-')
if (ch == '-' || ch == '+')
{
if (len == 1)
throw new NumberFormatException("pure '-'");
if (ch == '-')
throw new NumberFormatException("pure '-'");
else if (ch == '+')
throw new NumberFormatException("pure '+'");
isNeg = true;
ch = str.charAt(++index);
}

View file

@ -147,8 +147,7 @@ public final class Array
{
if (dimensions.length <= 0)
throw new IllegalArgumentException ("Empty dimensions array.");
return createMultiArray(componentType, dimensions,
dimensions.length - 1);
return createMultiArray(componentType, dimensions, 0);
}
/**
@ -638,10 +637,10 @@ public final class Array
private static Object createMultiArray(Class type, int[] dimensions,
int index)
{
if (index == 0)
return newInstance(type, dimensions[0]);
if (index == dimensions.length - 1)
return newInstance(type, dimensions[index]);
Object toAdd = createMultiArray(type, dimensions, index - 1);
Object toAdd = createMultiArray(type, dimensions, index + 1);
Class thisType = toAdd.getClass();
Object[] retval
= (Object[]) VMArray.createObjectArray(thisType, dimensions[index]);
@ -649,7 +648,7 @@ public final class Array
retval[0] = toAdd;
int i = dimensions[index];
while (--i > 0)
retval[i] = createMultiArray(type, dimensions, index - 1);
retval[i] = createMultiArray(type, dimensions, index + 1);
return retval;
}

View file

@ -262,10 +262,9 @@ public class URLClassLoader extends SecureClassLoader
super(parent);
this.securityContext = null;
this.factory = factory;
addURLs(urls);
// If this factory is still not in factoryCache, add it.
// If this factory is not yet in factoryCache, add it.
factoryCache.add(factory);
addURLs(urls);
}
// Methods
@ -624,10 +623,7 @@ public class URLClassLoader extends SecureClassLoader
}
catch (IOException ioe)
{
ClassNotFoundException cnfe;
cnfe = new ClassNotFoundException(className + " not found in " + this);
cnfe.initCause(ioe);
throw cnfe;
throw new ClassNotFoundException(className + " not found in " + this, ioe);
}
}

View file

@ -358,4 +358,65 @@ public abstract class Buffer
(arraylength < length + offset))
throw new IndexOutOfBoundsException ();
}
/**
* Returns the backing array of this buffer, if this buffer has one.
* Modification to the array are directly visible in this buffer and vice
* versa.
*
* <p>
* If this is a read-only buffer, then a {@link ReadOnlyBufferException} is
* thrown because exposing the array would allow to circumvent the read-only
* property. If this buffer doesn't have an array, then an
* {@link UnsupportedOperationException} is thrown. Applications should check
* if this buffer supports a backing array by calling {@link #hasArray}
* first.</p>
*
* @return the backing array of this buffer
*
* @throws ReadOnlyBufferException when this buffer is read only
* @throws UnsupportedOperationException when this buffer does not provide
* a backing array
*
* @since 1.6
*/
public abstract Object array();
/**
* Returns <code>true</code> if this buffer can provide a backing array,
* <code>false</code> otherwise. When <code>true</code>, application code
* can call {@link #array()} to access this backing array.
*
* @return <code>true</code> if this buffer can provide a backing array,
* <code>false</code> otherwise
*
* @since 1.6
*/
public abstract boolean hasArray();
/**
* For buffers that are backed by a Java array, this returns the offset
* into that array at which the buffer content starts.
*
* @return the offset into the backing array at which the buffer content
* starts
* @throws ReadOnlyBufferException when this buffer is read only
* @throws UnsupportedOperationException when this buffer does not provide
* a backing array
*
* @since 1.6
*/
public abstract int arrayOffset();
/**
* Returns <code>true</code> when this buffer is direct, <code>false</code>
* otherwise. A direct buffer is usually backed by a raw memory area instead
* of a Java array.
*
* @return <code>true</code> when this buffer is direct, <code>false</code>
* otherwise
*
* @since 1.6
*/
public abstract boolean isDirect();
}

View file

@ -107,20 +107,7 @@ public abstract class CharBuffer extends Buffer
*/
public static final CharBuffer wrap(CharSequence seq, int start, int end)
{
// FIXME: implement better handling of java.lang.String.
// Probably share data with String via reflection.
int len = end - start;
if( len < 0 )
throw new IndexOutOfBoundsException();
char[] buffer = new char[len];
for (int i = 0; i < len; i++)
buffer[i] = seq.charAt(i + start);
return wrap(buffer, 0, len).asReadOnlyBuffer();
return new CharSequenceBuffer(seq, start, end);
}
/**

View file

@ -0,0 +1,208 @@
/* CharBuffer.java --
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.nio;
/**
* A CharBuffer that wraps a {@link CharSequence}.
*/
final class CharSequenceBuffer
extends CharBuffer
{
/**
* The wrapped char sequence.
*/
private CharSequence charSequence;
/**
* Creates a new CharSequenceBuffer.
*
* @param charSeq the CharSequence to wrap
* @param capacity the capacity
* @param limit the limit
* @param position the position
* @param mark the mark
* @param offs the offset
*/
CharSequenceBuffer(CharSequence charSeq, int capacity, int limit,
int position, int mark, int offs)
{
super(capacity, limit, position, mark);
charSequence = charSeq;
array_offset = offs;
}
/**
* Creates a new instance of CharSequenceBuffer, wrapping the specified
* {@link CharSequence}.
*
* @param charSeq the char sequence to wrap
* @param start the start index in the char sequence
* @param end the end index in the char sequence
*/
CharSequenceBuffer(CharSequence charSeq, int start, int end)
{
this(charSeq, charSeq.length(), end, start, -1, 0);
}
/**
* Returns a read-only view of this buffer.
*/
public CharBuffer asReadOnlyBuffer()
{
return duplicate();
}
/**
* This buffer class is not writable by definition and thus throws
* a ReadOnlyBufferException here.
*/
public CharBuffer compact()
{
throw new ReadOnlyBufferException();
}
/**
* Returns a duplicate of this buffer.
*
* @return a duplicate of this buffer
*/
public CharBuffer duplicate()
{
return new CharSequenceBuffer(charSequence, cap, limit, pos, mark, 0);
}
/**
* Returns the character at the current position.
*
* @return the character at the current position
*/
public char get()
{
if (pos >= limit)
throw new BufferUnderflowException();
return charSequence.charAt(array_offset + pos++);
}
/**
* Returns the character at the specified position.
*
* @return the character at the specified position
*/
public char get(int index)
{
if (index < 0 || index >= limit)
throw new IndexOutOfBoundsException();
return charSequence.charAt(array_offset + index);
}
/**
* Cannot be direct, return <code>false</code> here.
*
* @return false
*/
public boolean isDirect()
{
return false;
}
/**
* Returns the byte order of this buffer. This is always the native byte
* order.
*
* @return the byte order of this buffer
*/
public ByteOrder order()
{
return ByteOrder.nativeOrder();
}
/**
* This buffer class is not writable by definition and thus throws
* a ReadOnlyBufferException here.
*/
public CharBuffer put(char b)
{
throw new ReadOnlyBufferException();
}
/**
* This buffer class is not writable by definition and thus throws
* a ReadOnlyBufferException here.
*/
public CharBuffer put(int index, char b)
{
throw new ReadOnlyBufferException();
}
/**
* Returns a slice of this buffer, exposing the current position and limit.
*/
public CharBuffer slice()
{
int newCapacity = limit - pos;
return new CharSequenceBuffer(charSequence, newCapacity, newCapacity, 0,
-1, pos);
}
/**
* Returns a sub sequence from the specified start index and with the
* specified length.
*
* @param start the start index
* @param length the length of the sub sequence
*/
public CharSequence subSequence(int start, int length)
{
int begin = array_offset + start + pos;
return charSequence.subSequence(begin, begin + length);
}
/**
* This kind of CharBuffer is read-only, so we return <code>true</code>
* here.
*/
public boolean isReadOnly()
{
return true;
}
}

View file

@ -133,7 +133,7 @@ class CharViewBufferImpl extends CharBuffer
public CharBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new CharViewBufferImpl (bb, (position () >> 1) + offset,
return new CharViewBufferImpl (bb, (position () << 1) + offset,
remaining (), remaining (), 0, -1,
isReadOnly (), endian);
}

View file

@ -130,7 +130,7 @@ final class DoubleViewBufferImpl extends DoubleBuffer
public DoubleBuffer slice ()
{
return new DoubleViewBufferImpl (bb, (position () >> 3) + offset,
return new DoubleViewBufferImpl (bb, (position () << 3) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}

View file

@ -131,7 +131,7 @@ final class FloatViewBufferImpl extends FloatBuffer
public FloatBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new FloatViewBufferImpl (bb, (position () >> 2) + offset,
return new FloatViewBufferImpl (bb, (position () << 2) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}

View file

@ -131,7 +131,7 @@ final class IntViewBufferImpl extends IntBuffer
public IntBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new IntViewBufferImpl (bb, (position () >> 2) + offset,
return new IntViewBufferImpl (bb, (position () << 2) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}

View file

@ -131,7 +131,7 @@ final class LongViewBufferImpl extends LongBuffer
public LongBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new LongViewBufferImpl (bb, (position () >> 3) + offset,
return new LongViewBufferImpl (bb, (position () << 3) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}

View file

@ -131,7 +131,7 @@ final class ShortViewBufferImpl extends ShortBuffer
public ShortBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new ShortViewBufferImpl (bb, (position () >> 1) + offset,
return new ShortViewBufferImpl (bb, (position () << 1) + offset,
remaining(), remaining(), 0, -1,
readOnly, endian);
}

View file

@ -58,7 +58,7 @@ import java.io.Serializable;
*
* @author unknown
*/
public final class MarshalledObject
public final class MarshalledObject<T>
implements Serializable
{
// The following fields are from Java API Documentation "Serialized form"
@ -74,7 +74,7 @@ public final class MarshalledObject
* @param obj the object to marshal
* @throws IOException if an I/O error during serialization occurs.
*/
public MarshalledObject(Object obj) throws IOException
public MarshalledObject(T obj) throws IOException
{
ByteArrayOutputStream objStream = new ByteArrayOutputStream();
RMIMarshalledObjectOutputStream stream =
@ -136,14 +136,14 @@ public final class MarshalledObject
* @throws ClassNotFoundException if the class of the deserialized object
* cannot be found.
*/
public Object get() throws IOException, ClassNotFoundException
public T get() throws IOException, ClassNotFoundException
{
if (objBytes == null)
return null;
RMIMarshalledObjectInputStream stream =
new RMIMarshalledObjectInputStream(objBytes, locBytes);
return stream.readObject();
return (T) stream.readObject();
}
public int hashCode()

View file

@ -103,7 +103,7 @@ public abstract class Activatable
* @throws ActivationException if the activation failed
* @throws RemoteException if the remote call failed.
*/
protected Activatable(String codebase, MarshalledObject data,
protected Activatable(String codebase, MarshalledObject<?> data,
boolean restart, int port) throws ActivationException,
RemoteException
{
@ -133,7 +133,7 @@ public abstract class Activatable
* @throws ActivationException if the activation failed
* @throws RemoteException if the remote call failed.
*/
protected Activatable(String codebase, MarshalledObject data,
protected Activatable(String codebase, MarshalledObject<?> data,
boolean restart, int port, RMIClientSocketFactory csf,
RMIServerSocketFactory ssf) throws ActivationException,
RemoteException
@ -314,7 +314,7 @@ public abstract class Activatable
* @throws RemoteException if the registration or export fails
*/
public static ActivationID exportObject(Remote obj, String location,
MarshalledObject data,
MarshalledObject<?> data,
boolean restart, int port)
throws ActivationException, RemoteException
{

View file

@ -80,7 +80,7 @@ public final class ActivationDesc
/**
* The object specific intitalization data.
*/
private MarshalledObject data;
private MarshalledObject<?> data;
/**
* The start mode.
@ -95,7 +95,7 @@ public final class ActivationDesc
* @param location the code base URL
* @param data the object initialization data, contained in a marshalled form
*/
public ActivationDesc(String className, String location, MarshalledObject data)
public ActivationDesc(String className, String location, MarshalledObject<?> data)
throws ActivationException
{
this(ActivationGroup.currentGroupID(), className, location, data, false);
@ -115,7 +115,7 @@ public final class ActivationDesc
* object is normally activated on demand).
*/
public ActivationDesc(String className, String location,
MarshalledObject data, boolean restart)
MarshalledObject<?> data, boolean restart)
throws ActivationException
{
this(ActivationGroup.currentGroupID(), className, location, data, restart);
@ -131,7 +131,7 @@ public final class ActivationDesc
* @param data the object initialization data, contained in a marshalled form
*/
public ActivationDesc(ActivationGroupID groupID, String className,
String location, MarshalledObject data)
String location, MarshalledObject<?> data)
{
this(groupID, className, location, data, false);
}
@ -150,7 +150,7 @@ public final class ActivationDesc
* object is normally activated on demand).
*/
public ActivationDesc(ActivationGroupID groupID, String className,
String location, MarshalledObject data, boolean restart)
String location, MarshalledObject<?> data, boolean restart)
{
this.groupid = groupID;
this.classname = className;
@ -184,7 +184,7 @@ public final class ActivationDesc
return location;
}
public MarshalledObject getData()
public MarshalledObject<?> getData()
{
return data;
}

View file

@ -314,7 +314,8 @@ public abstract class ActivationGroup
* @throws UnknownObjectException if such object is not registered
* @throws RemoteException on remote call (to monitor) error
*/
protected void activeObject(ActivationID id, MarshalledObject mObject)
protected void activeObject(ActivationID id,
MarshalledObject<? extends Remote> mObject)
throws ActivationException, UnknownObjectException, RemoteException
{
if (monitor!=null)

View file

@ -199,7 +199,7 @@ public final class ActivationGroupDesc
/**
* The group initialization data.
*/
final MarshalledObject data;
final MarshalledObject<?> data;
/**
* The path to the group jre and the parameters of this jre, may be
@ -252,7 +252,7 @@ public final class ActivationGroupDesc
* options.
*/
public ActivationGroupDesc(String aClassName, String aLocation,
MarshalledObject aData, Properties aProperties,
MarshalledObject<?> aData, Properties aProperties,
ActivationGroupDesc.CommandEnvironment environment)
{
className = aClassName;
@ -288,7 +288,7 @@ public final class ActivationGroupDesc
*
* @return the group intialization data in the marshalled form.
*/
public MarshalledObject getData()
public MarshalledObject<?> getData()
{
return data;
}

View file

@ -68,6 +68,6 @@ public interface ActivationInstantiator
* @throws ActivationException if the activation fails
* @throws RemoteException if the remote call fails
*/
MarshalledObject newInstance (ActivationID id, ActivationDesc desc)
MarshalledObject<? extends Remote> newInstance (ActivationID id, ActivationDesc desc)
throws ActivationException, RemoteException;
}

View file

@ -59,7 +59,7 @@ public interface ActivationMonitor extends Remote
* @throws UnknownObjectException is such object is not known in this group
* @throws RemoteException if remote call fails
*/
void activeObject (ActivationID id, MarshalledObject obj)
void activeObject (ActivationID id, MarshalledObject<? extends Remote> obj)
throws UnknownObjectException, RemoteException;
/**

View file

@ -67,6 +67,6 @@ public interface Activator
* @throws ActivationException if the activation has failed due other reason
* @throws RemoteException if the remote call has failed.
*/
MarshalledObject activate (ActivationID id, boolean force)
MarshalledObject<? extends Remote> activate (ActivationID id, boolean force)
throws ActivationException, UnknownObjectException, RemoteException;
}

View file

@ -3941,7 +3941,8 @@ public class Arrays
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
"the final index.");
T[] newArray = (T[]) new Object[to - from];
Class elemType = original.getClass().getComponentType();
T[] newArray = (T[]) Array.newInstance(elemType, to - from);
if (to > original.length)
{
System.arraycopy(original, from, newArray, 0,

View file

@ -273,6 +273,11 @@ public final class Currency
throw new
NullPointerException("The locale or its country is null.");
}
/* Check that country of locale given is valid. */
if (country.length() != 2)
throw new IllegalArgumentException();
/* Attempt to get the currency from the cache */
String code = (String) countryMap.get(country);
if (code == null)

View file

@ -1,5 +1,5 @@
/* EnumMap.java - Map where keys are enum constants
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -140,7 +140,8 @@ public class EnumMap<K extends Enum<K>, V>
Enum<K> e = (Enum<K>) key;
if (e.getDeclaringClass() != enumClass)
return null;
return store[e.ordinal()];
V o = store[e.ordinal()];
return o == emptySlot ? null : o;
}
public V put(K key, V value)
@ -387,8 +388,18 @@ public class EnumMap<K extends Enum<K>, V>
public EnumMap<K, V> clone()
{
/* This constructor provides this functionality */
return new EnumMap(this);
EnumMap<K, V> result;
try
{
result = (EnumMap<K, V>) super.clone();
}
catch (CloneNotSupportedException ignore)
{
// Can't happen.
result = null;
}
result.store = (V[]) store.clone();
return result;
}
}