This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java.awt - documentation and others - REVISED


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Dienstag, 14. Januar 2003 12:36 schrieb Michael Koch:
> Hi list,
>
> I have written a "little" patch for java.awt to add some
> documentation and some things more. Please review and comment.
>
> Michael

Here a better version of the patch.


Michael

- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+JCgAWSOgCCdjSDsRAne2AJ9c7bpDsYCyJ5z73GyNbhEe/B0wvgCghJct
DtoV/lqkNk8wbQEbJyKwJ+A=
=9vCx
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1626
diff -b -u -r1.1626 ChangeLog
--- ChangeLog	11 Jan 2003 01:17:18 -0000	1.1626
+++ ChangeLog	14 Jan 2003 15:05:24 -0000
@@ -1,3 +1,74 @@
+2003-01-14  Michael Koch  <konqueror@gmx.de>
+
+	* java/awt/Label.java
+	(Label): Implements javax.accessibility.Accessible;
+	* java/awt/List.java
+	(List): Implements javax.accessibility.Accessible;
+	* java/awt/ScrollPane.java
+	(ScrollPane): Implements javax.accessibility.Accessible;
+	* java/awt/Scrollbar.java
+	(Scrollbar): Implements javax.accessibility.Accessible;
+	* java/awt/TextComponent.java
+	(setCaretPosition): Throw exception, documentation added.
+	* java/awt/Toolkit.java:
+	Added some newlines in method documentations.
+	(createButton): Exception documentation added.
+	(createTextField): Exception documentation added.
+	(createLabel): Exception documentation added.
+	(createList): Exception documentation added.
+	(createCheckbox): Exception documentation added.
+	(createScrollbar): Exception documentation added.
+	(createScrollPane): Exception documentation added.
+	(createTextArea): Exception documentation added.
+	(createChoice): Exception documentation added.
+	(createFrame): Exception documentation added.
+	(createWindow): Exception documentation added.
+	(createDialog): Exception documentation added.
+	(createMenuBar): Exception documentation added.
+	(createMenu): Exception documentation added.
+	(createMenuItem): Exception documentation added.
+	(createFileDialog): Exception documentation added.
+	(createCheckboxMenuItem): Exception documentation added.
+	(loadSystemColors): Exception documentation added.
+	(setDynamicLayout): Exception documentation added.
+	(isDynamicLayoutSet): Exception documentation added.
+	(isDynamicLayoutActive): Exception documentation added.
+	(getScreenSize): Exception documentation added.
+	(getScreenResolution): Exception documentation added.
+	(getScreenInsets): Exception documentation added.
+	(getColorModel): Exception documentation added.
+	(getSystemClipboard): Exception documentation added.
+	(getSystemSelection): Exception documentation added.
+	(getMenuShortcutKeyMask): Exception documentation added.
+	(getSystemEventQueue): Exception documentation added.
+	* java/awt/Window.java:
+	Reindented some code.
+	(Window): Centralized implementation, documentation added.
+	(finalize): Documentation added.
+	(hide): Fixed typo in comment.
+	(getWindowListeners): Documentation added.
+	* java/awt/color/ColorSpace.java
+	(toRGB): Documentation added.
+	* java/awt/color/ICC_ColorSpace.java
+	(ICC_ColorSpace): Documentation added.
+	(toRGB): Throw exception, documentation added.
+	(fromRGB): Throw exception, documentation added.
+	(toCIEXYZ): Documentation added.
+	(fromCIEXYZ): Documentation added.
+	(getMinValue): Documentation added.
+	(getMaxValue): Documentation added.
+	* java/awt/geom/Dimension2D.java
+	(clone): Documentation added.
+	* java/awt/geom/GeneralPath.java
+	(clone): Documentation added.
+	* java/awt/geom/Line2D.java
+	(clone): Documentation added.
+	* java/awt/geom/QuadCurve2D.java
+	(clone): Documentation added.
+	* java/awt/image/ColorModel.java
+	(ColorModel): Throw exception, documentation added.
+	* java/awt/image/ImageFilter.java
+	(clone): Doesnt throw CloneNotSupportedException.
 2003-01-10  Michael Koch  <konqueror@gmx.de>
 
 	* java/net/DatagramSocket.java
Index: java/awt/Label.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Label.java,v
retrieving revision 1.9
diff -b -u -r1.9 Label.java
--- java/awt/Label.java	2 Jan 2003 00:14:22 -0000	1.9
+++ java/awt/Label.java	14 Jan 2003 15:06:19 -0000
@@ -40,6 +40,8 @@
 
 import java.awt.peer.LabelPeer;
 import java.awt.peer.ComponentPeer;
+import java.io.Serializable;
+import javax.accessibility.Accessible;
 
 /**
   * This component is used for displaying simple text strings that cannot
@@ -48,7 +50,7 @@
   * @author Aaron M. Renn (arenn@urbanophile.com)
   * @author Tom Tromey <tromey@cygnus.com>
   */
-public class Label extends Component implements java.io.Serializable
+public class Label extends Component implements Serializable, Accessible
 {
 
 /*
Index: java/awt/List.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/List.java,v
retrieving revision 1.9
diff -b -u -r1.9 List.java
--- java/awt/List.java	5 Jan 2003 01:18:21 -0000	1.9
+++ java/awt/List.java	14 Jan 2003 15:06:19 -0000
@@ -46,13 +46,15 @@
 import java.awt.peer.ListPeer;
 import java.awt.peer.ComponentPeer;
 import java.util.Vector;
+import javax.accessibility.Accessible;
 
 /**
   * Class that implements a listbox widget
   *
   * @author Aaron M. Renn (arenn@urbanophile.com)
   */
-public class List extends Component implements ItemSelectable, Serializable
+public class List extends Component
+  implements ItemSelectable, Serializable, Accessible
 {
 
 /*
Index: java/awt/ScrollPane.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/ScrollPane.java,v
retrieving revision 1.6
diff -b -u -r1.6 ScrollPane.java
--- java/awt/ScrollPane.java	2 Jan 2003 00:14:22 -0000	1.6
+++ java/awt/ScrollPane.java	14 Jan 2003 15:06:19 -0000
@@ -41,6 +41,8 @@
 import java.awt.peer.ScrollPanePeer;
 import java.awt.peer.ContainerPeer;
 import java.awt.peer.ComponentPeer;
+import java.io.Serializable;
+import javax.accessibility.Accessible;
 
 /**
   * This widget provides a scrollable region that allows a single 
@@ -48,7 +50,7 @@
   *
   * @author Aaron M. Renn (arenn@urbanophile.com)
   */
-public class ScrollPane extends Container implements java.io.Serializable
+public class ScrollPane extends Container implements Accessible, Serializable
 {
 
 /*
Index: java/awt/Scrollbar.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Scrollbar.java,v
retrieving revision 1.9
diff -b -u -r1.9 Scrollbar.java
--- java/awt/Scrollbar.java	2 Jan 2003 00:14:22 -0000	1.9
+++ java/awt/Scrollbar.java	14 Jan 2003 15:06:19 -0000
@@ -42,6 +42,8 @@
 import java.awt.peer.ComponentPeer;
 import java.awt.event.AdjustmentListener;
 import java.awt.event.AdjustmentEvent;
+import java.io.Serializable;
+import javax.accessibility.Accessible;
 
 /**
   * This class implements a scrollbar widget.
@@ -49,8 +51,9 @@
   * @author Aaron M. Renn (arenn@urbanophile.com)
   * @author Tom Tromey <tromey@cygnus.com>
   */
-public class Scrollbar extends Component implements Adjustable,
-                                                    java.io.Serializable
+public class Scrollbar extends Component implements Accessible,
+                                                    Adjustable,
+                                                    Serializable
 {
 
 // FIXME: Serialization readObject/writeObject
Index: java/awt/TextComponent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/TextComponent.java,v
retrieving revision 1.7
diff -b -u -r1.7 TextComponent.java
--- java/awt/TextComponent.java	24 Mar 2002 22:49:26 -0000	1.7
+++ java/awt/TextComponent.java	14 Jan 2003 15:06:19 -0000
@@ -291,10 +291,18 @@
   * Sets the caret position to the specified value.
   *
   * @param caretPosition The new caret position.
+  *
+  * @exception IllegalArgumentException If the value supplied for position
+  * is less than zero.
+  *
+  * @since 1.1
   */
 public synchronized void
 setCaretPosition(int caretPosition)
 {
+  if (caretPosition < 0)
+    throw new IllegalArgumentException ();
+  
   TextComponentPeer tcp = (TextComponentPeer)getPeer();
   if (tcp != null)
     tcp.setCaretPosition(caretPosition);
Index: java/awt/Toolkit.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Toolkit.java,v
retrieving revision 1.17
diff -b -u -r1.17 Toolkit.java
--- java/awt/Toolkit.java	16 Sep 2002 09:46:37 -0000	1.17
+++ java/awt/Toolkit.java	14 Jan 2003 15:06:20 -0000
@@ -123,7 +123,10 @@
    * Creates a peer object for the specified <code>Button</code>.
    *
    * @param target The <code>Button</code> to create the peer for.
+   * 
    * @return The peer for the specified <code>Button</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract ButtonPeer createButton(Button target);
 
@@ -132,6 +135,8 @@
    *
    * @param target The <code>TextField</code> to create the peer for.
    * @return The peer for the specified <code>TextField</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract TextFieldPeer createTextField(TextField target);
 
@@ -140,6 +145,8 @@
    *
    * @param target The <code>Label</code> to create the peer for.
    * @return The peer for the specified <code>Label</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract LabelPeer createLabel(Label target);
 
@@ -148,6 +155,8 @@
    *
    * @param target The <code>List</code> to create the peer for.
    * @return The peer for the specified <code>List</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract ListPeer createList(List target);
 
@@ -156,6 +165,8 @@
    *
    * @param target The <code>Checkbox</code> to create the peer for.
    * @return The peer for the specified <code>Checkbox</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract CheckboxPeer createCheckbox(Checkbox target);
 
@@ -164,6 +175,8 @@
    *
    * @param target The <code>Scrollbar</code> to create the peer for.
    * @return The peer for the specified <code>Scrollbar</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract ScrollbarPeer createScrollbar(Scrollbar target);
 
@@ -172,6 +185,8 @@
    *
    * @param target The <code>ScrollPane</code> to create the peer for.
    * @return The peer for the specified <code>ScrollPane</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract ScrollPanePeer createScrollPane(ScrollPane target);
 
@@ -180,6 +195,8 @@
    *
    * @param target The <code>TextArea</code> to create the peer for.
    * @return The peer for the specified <code>TextArea</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract TextAreaPeer createTextArea(TextArea target);
 
@@ -188,6 +205,8 @@
    *
    * @param target The <code>Choice</code> to create the peer for.
    * @return The peer for the specified <code>Choice</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract ChoicePeer createChoice(Choice target);
 
@@ -196,6 +215,8 @@
    *
    * @param target The <code>Frame</code> to create the peer for.
    * @return The peer for the specified <code>Frame</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract FramePeer createFrame(Frame target);
 
@@ -220,6 +241,8 @@
    *
    * @param target The <code>Window</code> to create the peer for.
    * @return The peer for the specified <code>Window</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract WindowPeer createWindow(Window target);
 
@@ -228,6 +251,8 @@
    *
    * @param target The dialog to create the peer for
    * @return The peer for the specified font name.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract DialogPeer createDialog(Dialog target);
 
@@ -236,6 +261,8 @@
    *
    * @param target The <code>MenuBar</code> to create the peer for.
    * @return The peer for the specified <code>MenuBar</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract MenuBarPeer createMenuBar(MenuBar target);
 
@@ -244,6 +271,8 @@
    *
    * @param target The <code>Menu</code> to create the peer for.
    * @return The peer for the specified <code>Menu</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract MenuPeer createMenu(Menu target);
 
@@ -252,6 +281,8 @@
    *
    * @param target The <code>PopupMenu</code> to create the peer for.
    * @return The peer for the specified <code>PopupMenu</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract PopupMenuPeer createPopupMenu(PopupMenu target);
 
@@ -260,6 +291,8 @@
    *
    * @param target The <code>MenuItem</code> to create the peer for.
    * @return The peer for the specified <code>MenuItem</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract MenuItemPeer createMenuItem(MenuItem target);
 
@@ -268,6 +301,8 @@
    *
    * @param target The <code>FileDialog</code> to create the peer for.
    * @return The peer for the specified <code>FileDialog</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract FileDialogPeer createFileDialog(FileDialog target);
 
@@ -276,6 +311,8 @@
    *
    * @param target The <code>CheckboxMenuItem</code> to create the peer for.
    * @return The peer for the specified <code>CheckboxMenuItem</code> object.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected abstract CheckboxMenuItemPeer
     createCheckboxMenuItem(CheckboxMenuItem target);
@@ -310,6 +347,8 @@
    * the interface used by the <code>SystemColors</code> class.
    *
    * @param colors The array to copy the system colors into.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected void loadSystemColors(int systemColors[])
   {
@@ -318,6 +357,8 @@
 
   /**
    * @since 1.4
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   public void setDynamicLayout(boolean dynamic)
   {
@@ -325,6 +366,8 @@
 
   /**
    * @since 1.4
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   protected boolean isDynamicLayoutSet()
   {
@@ -333,6 +376,8 @@
 
   /**
    * @since 1.4
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   public boolean isDynamicLayoutActive()
   {
@@ -343,6 +388,8 @@
    * Returns the dimensions of the screen in pixels.
    *
    * @return The dimensions of the screen in pixels.
+   * 
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   public abstract Dimension getScreenSize();
 
@@ -350,10 +397,14 @@
    * Returns the screen resolution in dots per square inch.
    *
    * @return The screen resolution in dots per square inch.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   public abstract int getScreenResolution();
 
   /**
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+   *
    * @since 1.4
    */
   public Insets getScreenInsets(GraphicsConfiguration gc)
@@ -396,6 +447,7 @@
    * if the property is not set.
    *
    * @return An instance of the system default toolkit.
+   *
    * @throws AWTError If the toolkit cannot be loaded.
    */
   public static Toolkit getDefaultToolkit()
@@ -450,6 +502,7 @@
    * @param height The height of the image.
    * @param observer The observer to receive events about the preparation
    * process.
+   *
    * @return <code>true</code> if the image is already prepared for rendering,
    * <code>false</code> otherwise.
    */
@@ -465,6 +518,7 @@
    * @param height The height of the image.
    * @param observer The observer to receive events about the preparation
    * process.
+   *
    * @return A union of the bitmasks from
    * <code>java.awt.image.ImageObserver</code> that indicates the current
    * state of the imaging readying process.
@@ -476,6 +530,7 @@
    * Creates an image using the specified <code>ImageProducer</code>
    *
    * @param producer The <code>ImageProducer</code> to create the image from.
+   *
    * @return The created image.
    */
   public abstract Image createImage(ImageProducer producer);
@@ -485,6 +540,7 @@
    * a recognized format.  Supported formats vary from toolkit to toolkit.
    *
    * @param data The raw image data.
+   *
    * @return The created image.
    */
   public Image createImage(byte[] data)
@@ -500,6 +556,7 @@
    * @param data The raw image data.
    * @param offset The offset into the data where the image data starts.
    * @param len The length of the image data.
+   *
    * @return The created image.
    */
   public abstract Image createImage(byte[] data, int offset, int len);
@@ -511,6 +568,7 @@
    * @param frame The window initiating the print job.
    * @param title The print job title.
    * @param props The print job properties.
+   *
    * @return The requested print job, or <code>null</code> if the job
    * was cancelled.
    */
@@ -536,10 +594,14 @@
    * Returns the system clipboard.
    *
    * @return THe system clipboard.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   public abstract Clipboard getSystemClipboard();
 
   /**
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+   *
    * @since 1.4
    */
   public Clipboard getSystemSelection()
@@ -553,6 +615,8 @@
    * to change the default.
    *
    * @return The key mask for the menu accelerator key.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
    */
   public int getMenuShortcutKeyMask()
   {
Index: java/awt/Window.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Window.java,v
retrieving revision 1.14
diff -b -u -r1.14 Window.java
--- java/awt/Window.java	9 Nov 2002 23:23:32 -0000	1.14
+++ java/awt/Window.java	14 Jan 2003 15:06:20 -0000
@@ -86,32 +86,56 @@
    * parent.  The window will initially be invisible.
    *
    * @param parent The owning <code>Frame</code> of this window.
+   *
+   * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+   * is not from a screen device, or if owner is null; this exception is always
+   * thrown when GraphicsEnvironment.isHeadless returns true.
    */
   public Window(Frame owner)
   {
-    this((Window) owner);
+    this (owner, owner.getGraphicsConfiguration ());
   }
 
-  /** @since 1.2 */
+  /**
+   * Initializes a new instance of <code>Window</code> with the specified
+   * parent.  The window will initially be invisible.   
+   *
+   * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+   * is not from a screen device, or if owner is null; this exception is always
+   * thrown when GraphicsEnvironment.isHeadless returns true.
+   *
+   * @since 1.2
+   */
   public Window(Window owner)
   {
-    this();
+    this (owner, owner.getGraphicsConfiguration ());
+  }
+  
+  /**
+   * Initializes a new instance of <code>Window</code> with the specified
+   * parent.  The window will initially be invisible.   
+   *
+   * @exception IllegalArgumentException If owner is null or if gc is not from a
+   * screen device; this exception is always thrown when
+   * GraphicsEnvironment.isHeadless returns true.
+   *
+   * @since 1.3
+   */
+  public Window(Window owner, GraphicsConfiguration gc)
+  {
+    this ();
+
     if (owner == null)
-      throw new IllegalArgumentException("owner must not be null");
+      throw new IllegalArgumentException ("owner must not be null");
     
     this.parent = owner;
 
     // FIXME: add to owner's "owned window" list
     //owner.owned.add(this); // this should be a weak reference
-  }
-  
-  /** @since 1.3 */
-  public Window(Window owner, GraphicsConfiguration gc)
-  {
-    this(owner);
 
     /*  FIXME: Security check
     SecurityManager.checkTopLevelWindow(...)
+    */
 
     if (gc != null
         && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
@@ -122,7 +146,6 @@
 			     .getDefaultScreenDevice()
 			     .getDefaultConfiguration();
     else
-    */    
     graphicsConfiguration = gc;
   }
 
@@ -134,6 +157,12 @@
     return super.getGraphicsConfigurationImpl();
   }
 
+  /**
+   * Disposes of the input methods and context, and removes the WeakReference
+   * which formerly pointed to this Window from the parent's owned Window list.
+   *
+   * @exception Throwable The Exception raised by this method.
+   */
   protected void finalize() throws Throwable
   {
     // FIXME: remove from owner's "owned window" list (Weak References)
@@ -185,7 +214,7 @@
 
   public void hide()
   {
-    // FIXME: call hide() on amy "owned" children here.
+    // FIXME: call hide() on any "owned" children here.
     super.hide();
   }
 
@@ -338,6 +367,11 @@
     windowListener = AWTEventMulticaster.remove(windowListener, listener);
   }
 
+  /**
+   * Returns an array of all the window listeners registered on this window.
+   *
+   * @since 1.4
+   */
   public synchronized WindowListener[] getWindowListeners()
   {
     return (WindowListener[])
@@ -345,7 +379,16 @@
                                        WindowListener.class);
   }
 
-  /** @since 1.3 */
+  /**
+   * Returns an array of all the objects currently registered as FooListeners
+   * upon this Window. FooListeners are registered using the addFooListener
+   * method.
+   *
+   * @exception ClassCastException If listenerType doesn't specify a class or
+   * interface that implements java.util.EventListener.
+   *
+   * @since 1.3
+   */
   public EventListener[] getListeners(Class listenerType)
   {
     if (listenerType == WindowListener.class)
Index: java/awt/color/ColorSpace.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/color/ColorSpace.java,v
retrieving revision 1.6
diff -b -u -r1.6 ColorSpace.java
--- java/awt/color/ColorSpace.java	2 Jan 2003 00:14:23 -0000	1.6
+++ java/awt/color/ColorSpace.java	14 Jan 2003 15:06:20 -0000
@@ -131,6 +131,13 @@
     return false;
   }
 
+  /**
+   * Transforms a color value assumed to be in this ColorSpace into a value in
+   * the default CS_sRGB color space.
+   *
+   * @exception ArrayIndexOutOfBoundsException If array length is not at least
+   * the number of components in this ColorSpace.
+   */
   public abstract float[] toRGB(float[] colorvalue);
 
   public abstract float[] fromRGB(float[] rgbvalue);
Index: java/awt/color/ICC_ColorSpace.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/color/ICC_ColorSpace.java,v
retrieving revision 1.6
diff -b -u -r1.6 ICC_ColorSpace.java
--- java/awt/color/ICC_ColorSpace.java	10 Nov 2002 00:16:42 -0000	1.6
+++ java/awt/color/ICC_ColorSpace.java	14 Jan 2003 15:06:20 -0000
@@ -81,6 +81,12 @@
    */
   private boolean needScaleInit;
 
+  /**
+   * Constructs a new ICC_ColorSpace from an ICC_Profile object.
+   *
+   * @exception IllegalArgumentException If profile is inappropriate for
+   * representing a ColorSpace.
+   */
   public ICC_ColorSpace(ICC_Profile profile)
   {
     super(CS_sRGB, profile.getNumComponents());
@@ -92,18 +98,45 @@
     return thisProfile;
   }
 
+  /**
+   * Transforms a color value assumed to be in this ColorSpace into a value in
+   * the default CS_sRGB color space.
+   *
+   * @exception ArrayIndexOutOfBoundsException If array length is not at least
+   * the number of components in this ColorSpace.
+   */
   public float[] toRGB(float[] colorvalue)
   {
+    if (colorvalue.length < numComponents)
+      throw new IllegalArgumentException ();
+      
     // FIXME: Always assumes sRGB:
     return colorvalue;
   }
 
+  /**
+   * Transforms a color value assumed to be in the default CS_sRGB color space
+   * into this ColorSpace.
+   *
+   * @exception ArrayIndexOutOfBoundsException If array length is not at
+   * least 3.
+   */
   public float[] fromRGB(float[] rgbvalue)
   {
+    if (rgbvalue.length < 3)
+      throw new IllegalArgumentException ();
+    
     // FIXME: Always assumes sRGB:
     return rgbvalue;
   }
 
+  /**
+   * Transforms a color value assumed to be in this ColorSpace into the
+   * CS_CIEXYZ conversion color space.
+   *
+   * @exception ArrayIndexOutOfBoundsException If array length is not at
+   * least the number of components in this ColorSpace.
+   */
   public float[] toCIEXYZ(float[] colorvalue)
   {
     // FIXME: Not implemented
Index: java/awt/geom/Dimension2D.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/geom/Dimension2D.java,v
retrieving revision 1.8
diff -b -u -r1.8 Dimension2D.java
--- java/awt/geom/Dimension2D.java	9 Aug 2002 04:26:15 -0000	1.8
+++ java/awt/geom/Dimension2D.java	14 Jan 2003 15:06:21 -0000
@@ -86,6 +86,7 @@
    * may occur.
    *
    * @param d the dimension containing the new values
+   *
    * @throws NullPointerException if d is null
    */
   public void setSize(Dimension2D d)
@@ -98,6 +99,10 @@
    * as this one.
    *
    * @return the clone
+   *
+   * @exception OutOfMemoryError If there is not enough memory available.
+   *
+   * @since 1.2
    */
   public Object clone()
   {
Index: java/awt/geom/GeneralPath.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/geom/GeneralPath.java,v
retrieving revision 1.1
diff -b -u -r1.1 GeneralPath.java
--- java/awt/geom/GeneralPath.java	9 Aug 2002 04:26:16 -0000	1.1
+++ java/awt/geom/GeneralPath.java	14 Jan 2003 15:06:21 -0000
@@ -338,6 +338,10 @@
    * this one.
    *
    * @return the clone
+   *
+   * @exception OutOfMemoryError If there is not enough memory available.
+   *
+   * @since 1.2
    */
   public Object clone()
   {
Index: java/awt/geom/Line2D.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/geom/Line2D.java,v
retrieving revision 1.4
diff -b -u -r1.4 Line2D.java
--- java/awt/geom/Line2D.java	9 Aug 2002 04:26:16 -0000	1.4
+++ java/awt/geom/Line2D.java	14 Jan 2003 15:06:22 -0000
@@ -752,6 +752,10 @@
    * this one.
    *
    * @return the clone
+   *
+   * @exception OutOfMemoryError If there is not enough memory available.
+   *
+   * @since 1.2
    */
   public Object clone()
   {
Index: java/awt/geom/QuadCurve2D.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/geom/QuadCurve2D.java,v
retrieving revision 1.1
diff -b -u -r1.1 QuadCurve2D.java
--- java/awt/geom/QuadCurve2D.java	9 Aug 2002 04:26:16 -0000	1.1
+++ java/awt/geom/QuadCurve2D.java	14 Jan 2003 15:06:22 -0000
@@ -289,6 +289,10 @@
    * this one.
    *
    * @return the clone
+   *
+   * @exception OutOfMemoryError If there is not enough memory available.
+   *
+   * @since 1.2
    */
   public Object clone()
   {
Index: java/awt/image/ColorModel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/ColorModel.java,v
retrieving revision 1.8
diff -b -u -r1.8 ColorModel.java
--- java/awt/image/ColorModel.java	30 Nov 2002 04:51:11 -0000	1.8
+++ java/awt/image/ColorModel.java	14 Jan 2003 15:06:22 -0000
@@ -120,10 +120,32 @@
 	 Buffers.smallestAppropriateTransferType(bits * 4));
   }
 
+  /**
+   * Constructs a ColorModel that translates pixel values to
+   * color/alpha components.
+   *
+   * @exception IllegalArgumentException If the length of the bit array is less
+   * than the number of color or alpha components in this ColorModel, or if the
+   * transparency is not a valid value, or if the sum of the number of bits in
+   * bits is less than 1 or if any of the elements in bits is less than 0.
+   */
   protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace,
 		       boolean hasAlpha, boolean isAlphaPremultiplied,
 		       int transparency, int transferType)
   {
+    int bits_sum = 0;
+    for (int i = 0; i < bits.length; i++)
+      {
+        if (bits [i] < 0)
+          throw new IllegalArgumentException ();
+
+        bits_sum += bits [i];
+      }
+    
+    if ((bits.length < cspace.numComponents)
+        || (bits_sum < 1))
+      throw new IllegalArgumentException ();
+
     this.pixel_bits = pixel_bits;
     this.bits = bits;
     this.cspace = cspace;
Index: java/awt/image/ImageFilter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/ImageFilter.java,v
retrieving revision 1.1
diff -b -u -r1.1 ImageFilter.java
--- java/awt/image/ImageFilter.java	24 Jan 2002 01:05:12 -0000	1.1
+++ java/awt/image/ImageFilter.java	14 Jan 2003 15:06:22 -0000
@@ -81,9 +81,18 @@
      *
      * @see java.lang.Object#clone ()
      */
-    public Object clone() throws CloneNotSupportedException
+    public Object clone()
     {
-	return (super.clone());
+      try
+        {
+          return super.clone();
+        }
+      catch (CloneNotSupportedException e)
+        {
+          // This should never happen as this class implements the
+          // Cloneable interface.
+          throw new InternalError ();
+        }
     }
 
     /**

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]