|
From: <ls...@us...> - 2007-01-09 20:25:14
|
Revision: 3061
http://jnode.svn.sourceforge.net/jnode/?rev=3061&view=rev
Author: lsantha
Date: 2007-01-09 12:25:00 -0800 (Tue, 09 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/awt/AlphaComposite.java
trunk/core/src/classpath/java/java/awt/Dialog.java
trunk/core/src/classpath/java/java/awt/Graphics2D.java
trunk/core/src/classpath/java/java/awt/Rectangle.java
trunk/core/src/classpath/java/java/awt/RenderingHints.java
trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java
trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java
trunk/core/src/classpath/java/java/awt/dnd/DragSource.java
trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java
trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java
trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java
trunk/core/src/classpath/java/java/awt/im/InputContext.java
trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java
trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java
trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java
trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java
trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java
trunk/core/src/classpath/java/java/awt/print/PrinterJob.java
trunk/core/src/classpath/java/java/io/FileDescriptor.java
trunk/core/src/classpath/java/java/io/FileInputStream.java
trunk/core/src/classpath/java/java/io/FileOutputStream.java
trunk/core/src/classpath/java/java/io/ObjectStreamField.java
trunk/core/src/classpath/java/java/io/OutputStreamWriter.java
trunk/core/src/classpath/java/java/io/PipedInputStream.java
trunk/core/src/classpath/java/java/io/PipedReader.java
trunk/core/src/classpath/java/java/io/PrintStream.java
trunk/core/src/classpath/java/java/io/RandomAccessFile.java
trunk/core/src/classpath/java/java/nio/ByteBuffer.java
trunk/core/src/classpath/java/java/nio/DoubleBuffer.java
trunk/core/src/classpath/java/java/nio/FloatBuffer.java
trunk/core/src/classpath/java/java/nio/IntBuffer.java
trunk/core/src/classpath/java/java/nio/LongBuffer.java
trunk/core/src/classpath/java/java/nio/ShortBuffer.java
trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java
trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java
trunk/core/src/classpath/java/java/util/prefs/Preferences.java
Modified: trunk/core/src/classpath/java/java/awt/AlphaComposite.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/AlphaComposite.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/AlphaComposite.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* AlphaComposite.java -- provides a context for performing alpha compositing
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,8 +61,8 @@
private static final int MAX_CACHE_SIZE = 2048;
/** Prune stale entries. */
- protected boolean removeEldestEntry(Map.Entry eldest)
- { // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
+ protected boolean removeEldestEntry(Entry eldest)
+ {
return size() > MAX_CACHE_SIZE;
}
};
Modified: trunk/core/src/classpath/java/java/awt/Dialog.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Dialog.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/Dialog.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -97,6 +97,11 @@
private EventQueue eq2 = null;
/**
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_dialog_number;
+
+ /**
* Initializes a new instance of <code>Dialog</code> with the specified
* parent, that is resizable and not modal, and which has no title.
*
@@ -190,6 +195,7 @@
visible = false;
setLayout(new BorderLayout());
+ setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
/**
@@ -273,6 +279,7 @@
visible = false;
setLayout(new BorderLayout());
+ setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
/**
@@ -531,4 +538,18 @@
return accessibleContext;
}
+ /**
+ * Generate a unique name for this <code>Dialog</code>.
+ *
+ * @return A unique name for this <code>Dialog</code>.
+ */
+ String generateName()
+ {
+ return "dialog" + getUniqueLong();
+ }
+
+ private static synchronized long getUniqueLong()
+ {
+ return next_dialog_number++;
+ }
}
Modified: trunk/core/src/classpath/java/java/awt/Graphics2D.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Graphics2D.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/Graphics2D.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -227,14 +227,14 @@
*
* @see #addRenderingHints(Map)
*/
- public abstract void setRenderingHints(Map hints);
+ public abstract void setRenderingHints(Map<?,?> hints);
/**
* Adds/updates the rendering hint.
*
* @param hints the hints to add or update.
*/
- public abstract void addRenderingHints(Map hints);
+ public abstract void addRenderingHints(Map<?,?> hints);
/**
* Returns the current rendering hints.
Modified: trunk/core/src/classpath/java/java/awt/Rectangle.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Rectangle.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/Rectangle.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -119,14 +119,10 @@
* coordinates of the specified rectangle.
*
* @param r the rectangle to copy from
- * @throws NullPointerException if r is null
* @since 1.1
*/
public Rectangle(Rectangle r)
{
- if (r == null)
- throw new NullPointerException();
-
x = r.x;
y = r.y;
width = r.width;
@@ -171,13 +167,9 @@
*
* @param p the upper left corner of the rectangle
* @param d the width and height of the rectangle
- * @throws NullPointerException if p or d is null
*/
public Rectangle(Point p, Dimension d)
{
- if (p == null || d == null)
- throw new NullPointerException();
-
x = p.x;
y = p.y;
width = d.width;
@@ -189,13 +181,9 @@
* corner at the specified point and a width and height of zero.
*
* @param p the upper left corner of the rectangle
- * @throws NullPointerException if p is null
*/
public Rectangle(Point p)
{
- if (p == null)
- throw new NullPointerException();
-
x = p.x;
y = p.y;
}
@@ -206,13 +194,9 @@
* by the specified dimension.
*
* @param d the width and height of the rectangle
- * @throws NullPointerException if d is null
*/
public Rectangle(Dimension d)
{
- if (d == null)
- throw new NullPointerException();
-
width = d.width;
height = d.height;
}
Modified: trunk/core/src/classpath/java/java/awt/RenderingHints.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -54,7 +54,8 @@
* @author Rolf W. Rasmussen (ro...@ii...)
* @author Eric Blake (eb...@em...)
*/
-public class RenderingHints implements Map, Cloneable
+public class RenderingHints
+ implements Map<Object,Object>, Cloneable
{
/**
* The base class used to represent keys.
@@ -550,7 +551,7 @@
* @param init a map containing a collection of hints (<code>null</code>
* permitted).
*/
- public RenderingHints(Map init)
+ public RenderingHints(Map<Key,?> init)
{
if (init != null)
putAll(init);
@@ -704,7 +705,7 @@
* @throws IllegalArgumentException if the map contains a value that is
* not compatible with its key.
*/
- public void putAll(Map m)
+ public void putAll(Map<?,?> m)
{
// preprocess map to generate appropriate exceptions
Iterator iterator = m.keySet().iterator();
@@ -723,7 +724,7 @@
*
* @return A set of keys.
*/
- public Set keySet()
+ public Set<Object> keySet()
{
return hintMap.keySet();
}
@@ -735,7 +736,7 @@
*
* @return A collection of values.
*/
- public Collection values()
+ public Collection<Object> values()
{
return hintMap.values();
}
@@ -745,7 +746,7 @@
*
* @return A set of entries.
*/
- public Set entrySet()
+ public Set<Map.Entry<Object,Object>> entrySet()
{
return Collections.unmodifiableSet(hintMap.entrySet());
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -59,7 +59,7 @@
private Component component;
private final Point origin;
private final int action;
- private List events;
+ private List<InputEvent> events;
private DragGestureRecognizer dgr;
/**
@@ -71,7 +71,7 @@
* @throws IllegalArgumentException - if input parameters are null
*/
public DragGestureEvent(DragGestureRecognizer dgr, int action, Point origin,
- List events)
+ List<? extends InputEvent> events)
{
super(dgr);
if (origin == null || events == null || dgr == null)
@@ -79,7 +79,7 @@
this.origin = origin;
this.action = action;
- this.events = events;
+ this.events = (List<InputEvent>) events;
this.dgr = dgr;
this.component = dgr.getComponent();
this.dragSource = dgr.getDragSource();
@@ -130,7 +130,7 @@
*
* @return an iterator representation of the List of events.
*/
- public Iterator iterator()
+ public Iterator<InputEvent> iterator()
{
return events.iterator();
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* DragGestureRecognizer.java --
- Copyright (C) 2002,2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@
package java.awt.dnd;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Component;
import java.awt.Point;
import java.awt.event.InputEvent;
@@ -52,6 +50,8 @@
/**
* STUBBED
+ * @author Michael Koch (kon...@gm...)
+ * @author Andrew John Hughes (gnu...@me...)
* @since 1.2
*/
public abstract class DragGestureRecognizer implements Serializable
@@ -65,7 +65,7 @@
protected Component component;
protected transient DragGestureListener dragGestureListener;
protected int sourceActions;
- protected ArrayList events = new ArrayList();
+ protected ArrayList<InputEvent> events = new ArrayList<InputEvent>();
protected DragGestureRecognizer(DragSource ds, Component c, int sa,
DragGestureListener dgl)
@@ -127,11 +127,12 @@
return events.size() > 0 ? (InputEvent) events.get(0) : null;
}
+ /**
+ * Resets the recognizer. If a gesture is currently recognize, discard it.
+ */
public void resetRecognizer()
- throws NotImplementedException
{
- events = new ArrayList();
- // FIXME: Not implemented fully.
+ events.clear();
}
/**
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragSource.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragSource.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragSource.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -226,12 +226,13 @@
return flavorMap;
}
- public DragGestureRecognizer createDragGestureRecognizer(Class recognizer,
+ public <T extends DragGestureRecognizer> T
+ createDragGestureRecognizer(Class<T> recognizer,
Component c,
int actions,
DragGestureListener dgl)
{
- return Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer,
+ return (T) Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer,
this, c,
actions, dgl);
}
@@ -296,7 +297,7 @@
/**
* @since 1.4
*/
- public EventListener[] getListeners (Class listenerType)
+ public <T extends EventListener> T[] getListeners (Class<T> listenerType)
{
if (listenerType == DragSourceListener.class)
return DnDEventMulticaster.getListeners (dragSourceListener,
@@ -307,7 +308,7 @@
listenerType);
// Return an empty EventListener array.
- return new EventListener [0];
+ return (T[]) new EventListener [0];
}
/**
Modified: trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -38,8 +38,6 @@
package java.awt.dnd;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Image;
@@ -268,7 +266,8 @@
for (int i = 0; i < dsl.length; i++)
dsl[i].dragExit(e);
- updateCurrentCursor(0, 0, DEFAULT);
+ updateCurrentCursor(DnDConstants.ACTION_NONE, DnDConstants.ACTION_NONE,
+ DEFAULT);
}
/**
@@ -340,26 +339,45 @@
* @param status - the status of the cursor (constant).
*/
protected void updateCurrentCursor(int dropOp, int targetAct, int status)
- throws NotImplementedException
{
- // FIXME: Not implemented fully
- if (!useCustomCursor)
+ if (! useCustomCursor)
{
- Cursor cursor = null;
+ Cursor newCursor = null;
switch (status)
{
+ default:
+ targetAct = DnDConstants.ACTION_NONE;
case ENTER:
- break;
case CHANGED:
- break;
case OVER:
- break;
- default:
- break;
+ int action = dropOp & targetAct;
+ if (action == DnDConstants.ACTION_NONE)
+ {
+ if ((dropOp & DnDConstants.ACTION_LINK) != 0)
+ newCursor = DragSource.DefaultLinkNoDrop;
+ else if ((dropOp & DnDConstants.ACTION_MOVE) != 0)
+ newCursor = DragSource.DefaultMoveNoDrop;
+ else
+ newCursor = DragSource.DefaultCopyNoDrop;
+ }
+ else
+ {
+ if ((dropOp & DnDConstants.ACTION_LINK) != 0)
+ newCursor = DragSource.DefaultLinkDrop;
+ else if ((dropOp & DnDConstants.ACTION_MOVE) != 0)
+ newCursor = DragSource.DefaultMoveDrop;
+ else
+ newCursor = DragSource.DefaultCopyDrop;
+ }
}
- this.cursor = cursor;
- peer.setCursor(cursor);
+ if (cursor == null || ! cursor.equals(newCursor))
+ {
+ cursor = newCursor;
+ DragSourceContextPeer p = peer;
+ if (p != null)
+ p.setCursor(cursor);
+ }
}
}
} // class DragSourceContext
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -38,12 +38,12 @@
package java.awt.dnd;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
+import java.awt.Insets;
import java.awt.Point;
+import java.awt.Rectangle;
import java.awt.datatransfer.FlavorMap;
import java.awt.datatransfer.SystemFlavorMap;
import java.awt.dnd.peer.DropTargetPeer;
@@ -55,6 +55,8 @@
import java.util.EventListener;
import java.util.TooManyListenersException;
+import javax.swing.Timer;
+
/**
* @author Michael Koch
* @since 1.2
@@ -70,30 +72,87 @@
protected static class DropTargetAutoScroller
implements ActionListener
{
+ /**
+ * The threshold that keeps the autoscroller running.
+ */
+ private static final int HYSTERESIS = 10;
+
+ /**
+ * The initial timer delay.
+ */
+ private static final int DELAY = 100;
+
private Component component;
private Point point;
+ /**
+ * The timer that triggers autoscrolling.
+ */
+ private Timer timer;
+
+ /**
+ * The outer region of the scroller. This is the component's size.
+ */
+ private Rectangle outer;
+
+ /**
+ * The inner region of the scroller. This is the component size without
+ * the autoscroll insets.
+ */
+ private Rectangle inner;
+
protected DropTargetAutoScroller (Component c, Point p)
{
component = c;
point = p;
+ timer = new Timer(DELAY, this);
+ timer.setCoalesce(true);
+ timer.start();
}
protected void updateLocation (Point newLocn)
{
+ Point previous = point;
point = newLocn;
+ if (Math.abs(point.x - previous.x) > HYSTERESIS
+ || Math.abs(point.y - previous.y) > HYSTERESIS)
+ {
+ if (timer.isRunning())
+ timer.stop();
+ }
+ else
+ {
+ if (! timer.isRunning())
+ timer.start();
+ }
}
protected void stop ()
- throws NotImplementedException
{
- // FIXME: implement this
+ timer.start();
}
public void actionPerformed (ActionEvent e)
- throws NotImplementedException
{
- // FIXME: implement this
+ Autoscroll autoScroll = (Autoscroll) component;
+
+ // First synchronize the inner and outer rectangles.
+ Insets i = autoScroll.getAutoscrollInsets();
+ int width = component.getWidth();
+ int height = component.getHeight();
+ if (width != outer.width || height != outer.height)
+ outer.setBounds(0, 0, width, height);
+ if (inner.x != i.left || inner.y != i.top)
+ inner.setLocation(i.left, i.top);
+ int inWidth = width - i.left - i.right;
+ int inHeight = height - i.top - i.bottom;
+ if (inWidth != inner.width || inHeight != inner.height)
+ inner.setSize(inWidth, inHeight);
+
+ // Scroll if the outer rectangle contains the location, but the
+ // inner doesn't.
+ if (outer.contains(point) && ! inner.contains(point))
+ autoScroll.autoscroll(point);
}
}
@@ -182,6 +241,8 @@
*/
public void setComponent (Component c)
{
+ if (component != null)
+ clearAutoscroll();
component = c;
}
@@ -212,6 +273,8 @@
public void setActive (boolean active)
{
this.active = active;
+ if (! active)
+ clearAutoscroll();
}
public boolean isActive()
@@ -250,30 +313,47 @@
public void dragEnter(DropTargetDragEvent dtde)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dragEnter(dtde);
+ initializeAutoscrolling(dtde.getLocation());
+ }
}
public void dragOver(DropTargetDragEvent dtde)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dragOver(dtde);
+ updateAutoscroll(dtde.getLocation());
+ }
}
public void dropActionChanged(DropTargetDragEvent dtde)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dropActionChanged(dtde);
+ updateAutoscroll(dtde.getLocation());
+ }
}
public void dragExit(DropTargetEvent dte)
{
+ if (active)
+ {
if (dropTargetListener != null)
dropTargetListener.dragExit(dte);
+ clearAutoscroll();
+ }
}
public void drop(DropTargetDropEvent dtde)
{
+ clearAutoscroll();
if (dropTargetListener != null)
dropTargetListener.drop(dtde);
}
@@ -332,15 +412,13 @@
protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller
(Component c, Point p)
{
- if (autoscroller == null)
- autoscroller = new DropTarget.DropTargetAutoScroller (c, p);
-
- return autoscroller;
+ return new DropTarget.DropTargetAutoScroller (c, p);
}
protected void initializeAutoscrolling(Point p)
{
- createDropTargetAutoScroller (component, p);
+ if (component instanceof Autoscroll) // Checks for null too.
+ autoscroller = createDropTargetAutoScroller (component, p);
}
protected void updateAutoscroll(Point dragCursorLocn)
@@ -351,6 +429,10 @@
protected void clearAutoscroll()
{
+ if (autoscroller != null)
+ {
+ autoscroller.stop();
autoscroller = null;
}
+ }
} // class DropTarget
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* DropTargetContext.java --
- Copyright (C) 2002, 2003, 2004, 2006, Free Software Foundation
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -49,6 +49,7 @@
/**
* @author Michael Koch (kon...@gm...)
+ * @author Andrew John Hughes (gnu...@me...)
* @since 1.2
*/
public class DropTargetContext implements Serializable
@@ -128,51 +129,51 @@
*
* @exception InvalidDnDOperationException If a drop is not outstanding.
*/
- public void dropComplete(boolean success)
+ public void dropComplete (boolean success)
{
if (dtcp != null)
dtcp.dropComplete(success);
}
- protected void acceptDrag(int dragOperation)
+ protected void acceptDrag (int dragOperation)
{
if (dtcp != null)
dtcp.acceptDrag(dragOperation);
}
- protected void rejectDrag()
+ protected void rejectDrag ()
{
if (dtcp != null)
dtcp.rejectDrag();
}
- protected void acceptDrop(int dropOperation)
+ protected void acceptDrop (int dropOperation)
{
if (dtcp != null)
dtcp.acceptDrop(dropOperation);
}
- protected void rejectDrop()
+ protected void rejectDrop ()
{
if (dtcp != null)
dtcp.rejectDrop();
}
- protected DataFlavor[] getCurrentDataFlavors()
+ protected DataFlavor[] getCurrentDataFlavors ()
{
if (dtcp != null)
dtcp.getTransferDataFlavors();
return null;
}
- protected List getCurrentDataFlavorsAsList()
+ protected List<DataFlavor> getCurrentDataFlavorsAsList ()
{
- return Arrays.asList(getCurrentDataFlavors());
+ return Arrays.asList(getCurrentDataFlavors ());
}
- protected boolean isDataFlavorSupported(DataFlavor flavor)
+ protected boolean isDataFlavorSupported (DataFlavor flavor)
{
- return getCurrentDataFlavorsAsList().contains(flavor);
+ return getCurrentDataFlavorsAsList().contains (flavor);
}
/**
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -108,7 +108,7 @@
return context.getCurrentDataFlavors ();
}
- public List getCurrentDataFlavorsAsList ()
+ public List<DataFlavor> getCurrentDataFlavorsAsList ()
{
return context.getCurrentDataFlavorsAsList ();
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* DropTargetDropEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -123,7 +123,7 @@
return context.getCurrentDataFlavors();
}
- public List getCurrentDataFlavorsAsList()
+ public List<DataFlavor> getCurrentDataFlavorsAsList()
{
return context.getCurrentDataFlavorsAsList();
}
Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -41,6 +41,10 @@
public class DropTargetEvent extends EventObject
{
+
+ /**
+ * Serialization identifier for Sun 1.5 compatability
+ */
private static final long serialVersionUID = 2821229066521922993L;
protected DropTargetContext context;
Modified: trunk/core/src/classpath/java/java/awt/im/InputContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/im/InputContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/im/InputContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -76,6 +76,7 @@
* java.awt.im.spi.InputMethodDescriptor.
*
* @author Eric Blake (eb...@em...)
+ * @author Andrew John Hughes (gnu...@me...)
* @see Component#getInputContext()
* @see Component#enableInputMethods(boolean)
* @since 1.2
@@ -86,7 +87,9 @@
/**
* The list of installed input method descriptors.
*/
- private static final ArrayList descriptors = new ArrayList();
+ private static final ArrayList<InputMethodDescriptor> descriptors
+ = new ArrayList<InputMethodDescriptor>();
+
static
{
Enumeration e;
@@ -123,7 +126,7 @@
{
if (line.charAt(0) != '#')
{
- Class c = Class.forName(line);
+ Class<?> c = Class.forName(line);
descriptors.add((InputMethodDescriptor) c.newInstance());
}
line = in.readLine().trim();
@@ -143,7 +146,8 @@
private InputMethod im;
/** Map of locales to the most recently selected input method. */
- private final HashMap recent = new HashMap();
+ private final HashMap<Locale,InputMethod> recent
+ = new HashMap<Locale,InputMethod>();
/** The list of acceptable character subsets. */
private Character.Subset[] subsets;
Modified: trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -41,6 +41,7 @@
import java.text.Annotation;
import java.text.AttributedCharacterIterator;
import java.util.Map;
+import java.awt.font.TextAttribute;
/**
* This describes the highlight attributes of text composed in an input method.
@@ -95,7 +96,7 @@
private final int variation;
/** The unmodifiable map of rendering styles. */
- private final Map style;
+ private final Map<TextAttribute, ?> style;
/**
* Create an input method highlight style, with variation 0 and null style
@@ -134,7 +135,7 @@
* @since 1.3
*/
public InputMethodHighlight(boolean selected, int state, int variation,
- Map style)
+ Map<TextAttribute, ?> style)
{
if (state != RAW_TEXT && state != CONVERTED_TEXT)
throw new IllegalArgumentException();
@@ -181,7 +182,7 @@
* @return the style map
* @since 1.3
*/
- public Map getStyle()
+ public Map<TextAttribute, ?> getStyle()
{
return style;
}
Modified: trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -1,5 +1,5 @@
/* InputMethodContext.java -- communication between an input method and client
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,6 +53,7 @@
* {@link InputMethod#setInputMethodContext(InputMethodContext)}.
*
* @author Eric Blake (eb...@em...)
+ * @author Andrew John Hughes (gnu...@me...)
* @since 1.3
* @status updated to 1.4
*/
Modified: trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -45,20 +45,20 @@
public class ParameterBlock implements Cloneable, Serializable
{
private static final long serialVersionUID = -7577115551785240750L;
- protected Vector sources;
- protected Vector parameters;
+ protected Vector<Object> sources;
+ protected Vector<Object> parameters;
public ParameterBlock()
{
- this(new Vector(), new Vector());
+ this(new Vector<Object>(), new Vector<Object>());
}
- public ParameterBlock(Vector sources)
+ public ParameterBlock(Vector<Object> sources)
{
- this(sources, new Vector());
+ this(sources, new Vector<Object>());
}
- public ParameterBlock(Vector sources, Vector parameters)
+ public ParameterBlock(Vector<Object> sources, Vector<Object> parameters)
{
this.sources = sources;
this.parameters = parameters;
@@ -80,9 +80,9 @@
{
ParameterBlock pb = (ParameterBlock) shallowClone();
if (sources != null)
- pb.sources = (Vector) sources.clone();
+ pb.sources = (Vector<Object>) sources.clone();
if (parameters != null)
- pb.parameters = (Vector) parameters.clone();
+ pb.parameters = (Vector<Object>) parameters.clone();
return pb;
}
@@ -119,12 +119,12 @@
return sources.size();
}
- public Vector getSources()
+ public Vector<Object> getSources()
{
return sources;
}
- public void setSources(Vector sources)
+ public void setSources(Vector<Object> sources)
{
this.sources = sources;
}
@@ -140,12 +140,12 @@
return parameters.size();
}
- public Vector getParameters()
+ public Vector<Object> getParameters()
{
return parameters;
}
- public void setParameters(Vector parameters)
+ public void setParameters(Vector<Object> parameters)
{
this.parameters = parameters;
}
Modified: trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -46,7 +46,7 @@
{
String HINTS_OBSERVED = "HINTS_OBSERVED";
- Vector getSources();
+ Vector<RenderableImage> getSources();
Object getProperty(String name);
String[] getPropertyNames();
boolean isDynamic();
Modified: trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -55,7 +55,7 @@
this.block = (ParameterBlock) block.clone();
}
- public Vector getSources()
+ public Vector<RenderableImage> getSources()
{
if (block.sources == null)
return null;
Modified: trunk/core/src/classpath/java/java/awt/print/PrinterJob.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/print/PrinterJob.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/awt/print/PrinterJob.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -38,6 +38,8 @@
package java.awt.print;
+import gnu.java.awt.print.JavaPrinterJob;
+
import java.awt.HeadlessException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
@@ -62,8 +64,7 @@
*/
public static PrinterJob getPrinterJob()
{
- // FIXME: Need to fix this to load a default implementation instance.
- return new NoPrinterJob();
+ return new JavaPrinterJob();
}
/**
Modified: trunk/core/src/classpath/java/java/io/FileDescriptor.java
===================================================================
--- trunk/core/src/classpath/java/java/io/FileDescriptor.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/FileDescriptor.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -134,6 +134,7 @@
*/
public boolean valid ()
{
- return channel != null && channel.isOpen();
+ ByteChannel c = channel;
+ return (c != null) && (c.isOpen());
}
}
Modified: trunk/core/src/classpath/java/java/io/FileInputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/FileInputStream.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/FileInputStream.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -40,6 +40,7 @@
import gnu.java.nio.channels.FileChannelImpl;
+import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -107,8 +108,21 @@
if (s != null)
s.checkRead(file.getPath());
+ try
+ {
ch = FileChannelImpl.create(file, FileChannelImpl.READ);
}
+ catch (FileNotFoundException fnfe)
+ {
+ throw fnfe;
+ }
+ catch (IOException ioe)
+ {
+ FileNotFoundException fnfe = new FileNotFoundException(file.getPath());
+ fnfe.initCause(ioe);
+ throw fnfe;
+ }
+ }
/**
* This method initializes a <code>FileInputStream</code> to read from the
@@ -266,7 +280,7 @@
|| offset + len > buf.length)
throw new ArrayIndexOutOfBoundsException();
- return ch.read(buf, offset, len);
+ return ch.read(ByteBuffer.wrap(buf, offset, len));
}
/**
Modified: trunk/core/src/classpath/java/java/io/FileOutputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/FileOutputStream.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/FileOutputStream.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -40,6 +40,7 @@
import gnu.java.nio.channels.FileChannelImpl;
+import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -155,11 +156,24 @@
if (s != null)
s.checkWrite(file.getPath());
+ try
+ {
ch = FileChannelImpl.create(file, (append
? FileChannelImpl.WRITE
| FileChannelImpl.APPEND
: FileChannelImpl.WRITE));
}
+ catch (FileNotFoundException fnfe)
+ {
+ throw fnfe;
+ }
+ catch (IOException ioe)
+ {
+ FileNotFoundException fnfe = new FileNotFoundException(file.getPath());
+ fnfe.initCause(ioe);
+ throw fnfe;
+ }
+ }
/**
* This method initializes a <code>FileOutputStream</code> object to write
@@ -266,7 +280,7 @@
|| offset + len > buf.length)
throw new ArrayIndexOutOfBoundsException ();
- ch.write (buf, offset, len);
+ ch.write(ByteBuffer.wrap(buf, offset, len));
}
/**
Modified: trunk/core/src/classpath/java/java/io/ObjectStreamField.java
===================================================================
--- trunk/core/src/classpath/java/java/io/ObjectStreamField.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/ObjectStreamField.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -65,7 +65,7 @@
private boolean unshared;
private boolean persistent = false;
private boolean toset = true;
- private Field field;
+ Field field;
ObjectStreamField (Field field)
{
Modified: trunk/core/src/classpath/java/java/io/OutputStreamWriter.java
===================================================================
--- trunk/core/src/classpath/java/java/io/OutputStreamWriter.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/OutputStreamWriter.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -223,6 +223,7 @@
encoder.onMalformedInput(CodingErrorAction.REPLACE);
encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
}
/**
@@ -240,6 +241,11 @@
this.out = out;
encoder = enc;
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ Charset cs = enc.charset();
+ if (cs == null)
+ encodingName = "US-ASCII";
+ else
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
}
/**
Modified: trunk/core/src/classpath/java/java/io/PipedInputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/PipedInputStream.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/PipedInputStream.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -279,6 +279,10 @@
if (closed)
throw new IOException ("Pipe closed");
+ // Don't block if nothing was requested.
+ if (len == 0)
+ return 0;
+
// If the buffer is empty, wait until there is something in the pipe
// to read.
try
Modified: trunk/core/src/classpath/java/java/io/PipedReader.java
===================================================================
--- trunk/core/src/classpath/java/java/io/PipedReader.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/PipedReader.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -261,6 +261,10 @@
if (closed)
throw new IOException ("Pipe closed");
+ // Don't block if nothing was requested.
+ if (len == 0)
+ return 0;
+
// If the buffer is empty, wait until there is something in the pipe
// to read.
try
Modified: trunk/core/src/classpath/java/java/io/PrintStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/PrintStream.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/PrintStream.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -71,7 +71,7 @@
// Line separator string.
private static final char[] line_separator
- = SystemProperties.getProperty("line.separator").toCharArray();
+ = SystemProperties.getProperty("line.separator", "\n").toCharArray();
/**
* Encoding name
Modified: trunk/core/src/classpath/java/java/io/RandomAccessFile.java
===================================================================
--- trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -122,7 +122,20 @@
s.checkWrite(fileName);
}
+ try
+ {
ch = FileChannelImpl.create(file, fdmode);
+ }
+ catch (FileNotFoundException fnfe)
+ {
+ throw fnfe;
+ }
+ catch (IOException ioe)
+ {
+ FileNotFoundException fnfe = new FileNotFoundException(file.getPath());
+ fnfe.initCause(ioe);
+ throw fnfe;
+ }
fd = new FileDescriptor(ch);
if ((fdmode & FileChannelImpl.WRITE) != 0)
out = new DataOutputStream (new FileOutputStream (fd));
Modified: trunk/core/src/classpath/java/java/nio/ByteBuffer.java
===================================================================
--- trunk/core/src/classpath/java/java/nio/ByteBuffer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/nio/ByteBuffer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -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 @@
* @since 1.4
*/
public abstract class ByteBuffer extends Buffer
- implements Comparable
+ implements Comparable<ByteBuffer>
{
ByteOrder endian = ByteOrder.BIG_ENDIAN;
@@ -290,7 +290,7 @@
{
if (obj instanceof ByteBuffer)
{
- return compareTo (obj) == 0;
+ return compareTo ((ByteBuffer) obj) == 0;
}
return false;
@@ -302,10 +302,8 @@
* @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();
Modified: trunk/core/src/classpath/java/java/nio/DoubleBuffer.java
===================================================================
--- trunk/core/src/classpath/java/java/nio/DoubleBuffer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/nio/DoubleBuffer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -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 @@
* @since 1.4
*/
public abstract class DoubleBuffer extends Buffer
- implements Comparable
+ implements Comparable<DoubleBuffer>
{
int array_offset;
double[] backing_buffer;
@@ -273,7 +273,7 @@
{
if (obj instanceof DoubleBuffer)
{
- return compareTo (obj) == 0;
+ return compareTo ((DoubleBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@
* @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();
Modified: trunk/core/src/classpath/java/java/nio/FloatBuffer.java
===================================================================
--- trunk/core/src/classpath/java/java/nio/FloatBuffer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/nio/FloatBuffer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -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 @@
* @since 1.4
*/
public abstract class FloatBuffer extends Buffer
- implements Comparable
+ implements Comparable<FloatBuffer>
{
int array_offset;
float[] backing_buffer;
@@ -273,7 +273,7 @@
{
if (obj instanceof FloatBuffer)
{
- return compareTo (obj) == 0;
+ return compareTo ((FloatBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@
* @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();
Modified: trunk/core/src/classpath/java/java/nio/IntBuffer.java
===================================================================
--- trunk/core/src/classpath/java/java/nio/IntBuffer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/nio/IntBuffer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -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 @@
* @since 1.4
*/
public abstract class IntBuffer extends Buffer
- implements Comparable
+ implements Comparable<IntBuffer>
{
int array_offset;
int[] backing_buffer;
@@ -273,7 +273,7 @@
{
if (obj instanceof IntBuffer)
{
- return compareTo (obj) == 0;
+ return compareTo ((IntBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@
* @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();
Modified: trunk/core/src/classpath/java/java/nio/LongBuffer.java
===================================================================
--- trunk/core/src/classpath/java/java/nio/LongBuffer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/nio/LongBuffer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -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 @@
* @since 1.4
*/
public abstract class LongBuffer extends Buffer
- implements Comparable
+ implements Comparable<LongBuffer>
{
int array_offset;
long[] backing_buffer;
@@ -273,7 +273,7 @@
{
if (obj instanceof LongBuffer)
{
- return compareTo (obj) == 0;
+ return compareTo ((LongBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@
* @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();
Modified: trunk/core/src/classpath/java/java/nio/ShortBuffer.java
===================================================================
--- trunk/core/src/classpath/java/java/nio/ShortBuffer.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/nio/ShortBuffer.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -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 @@
* @since 1.4
*/
public abstract class ShortBuffer extends Buffer
- implements Comparable
+ implements Comparable<ShortBuffer>
{
int array_offset;
short[] backing_buffer;
@@ -273,7 +273,7 @@
{
if (obj instanceof ShortBuffer)
{
- return compareTo (obj) == 0;
+ return compareTo ((ShortBuffer) obj) == 0;
}
return false;
@@ -285,10 +285,8 @@
* @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();
Modified: trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java
===================================================================
--- trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -60,7 +60,7 @@
/**
* Return a list of all logger names.
*/
- List/*<String>*/ getLoggerNames();
+ List<String> getLoggerNames();
/**
* Return the name of the parent of the indicated logger.
Modified: trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java
===================================================================
--- trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -45,6 +45,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.TreeSet;
@@ -97,17 +98,18 @@
* accessed by earlier <code>getChild()</code> or <code>childSpi()</code>
* invocations and that have not been removed.
*/
- private HashMap childCache = new HashMap();
+ private HashMap<String, AbstractPreferences> childCache
+ = new HashMap<String, AbstractPreferences>();
/**
* A list of all the registered NodeChangeListener objects.
*/
- private ArrayList nodeListeners;
+ private ArrayList<NodeChangeListener> nodeListeners;
/**
* A list of all the registered PreferenceChangeListener objects.
*/
- private ArrayList preferenceListeners;
+ private ArrayList<PreferenceChangeListener> preferenceListeners;
// constructor
@@ -202,7 +204,8 @@
*/
protected final AbstractPreferences[] cachedChildren()
{
- return (AbstractPreferences[]) childCache.values().toArray();
+ Collection<AbstractPreferences> vals = childCache.values();
+ return vals.toArray(new AbstractPreferences[vals.size()]);
}
/**
@@ -228,7 +231,7 @@
if (isRemoved())
throw new IllegalStateException("Node removed");
- TreeSet childrenNames = new TreeSet();
+ TreeSet<String> childrenNames = new TreeSet<String>();
// First get all cached node names
childrenNames.addAll(childCache.keySet());
@@ -1165,7 +1168,7 @@
if (listener == null)
throw new NullPointerException("listener is null");
if (nodeListeners == null)
- nodeListeners = new ArrayList();
+ nodeListeners = new ArrayList<NodeChangeListener>();
nodeListeners.add(listener);
}
}
@@ -1184,7 +1187,7 @@
if (listener == null)
throw new NullPointerException("listener is null");
if (preferenceListeners == null)
- preferenceListeners = new ArrayList();
+ preferenceListeners = new ArrayList<PreferenceChangeListener>();
preferenceListeners.add(listener);
}
}
Modified: trunk/core/src/classpath/java/java/util/prefs/Preferences.java
===================================================================
--- trunk/core/src/classpath/java/java/util/prefs/Preferences.java 2007-01-09 20:23:23 UTC (rev 3060)
+++ trunk/core/src/classpath/java/java/util/prefs/Preferences.java 2007-01-09 20:25:00 UTC (rev 3061)
@@ -183,9 +183,9 @@
// Get the factory
if (factory == null) {
// Caller might not have enough permissions
- factory = (PreferencesFactory) AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ factory = AccessController.doPrivileged(
+ new PrivilegedAction<PreferencesFactory>() {
+ public PreferencesFactory run() {
PreferencesFactory pf = null;
String className = System.getProperty
("java.util.prefs.PreferencesFactory");
@@ -251,7 +251,7 @@
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
- public static Preferences systemNodeForPackage(Class c)
+ public static Preferences systemNodeForPackage(Class<?> c)
throws SecurityException
{
return nodeForPackage(c, systemRoot());
@@ -270,7 +270,7 @@
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
- public static Preferences userNodeForPackage(Class c)
+ public static Preferences userNodeForPackage(Class<?> c)
throws SecurityException
{
return nodeForPackage(c, userRoot());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|