Hi list,
I commited the attached patch from David Gilbert to fix some issues in java.awt.font.TransformAttribute. Michael 2005-02-18 David Gilbert <[EMAIL PROTECTED]> * java/awt/font/TransformAttribute.java, (TransformAttribute(AffineTransform)): throw IllegalArgumentException for null transform. (getTransform): return a copy of transform. Added doc comments to all.
Index: java/awt/font/TransformAttribute.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/font/TransformAttribute.java,v retrieving revision 1.1 diff -u -r1.1 TransformAttribute.java --- java/awt/font/TransformAttribute.java 17 Feb 2003 08:05:50 -0000 1.1 +++ java/awt/font/TransformAttribute.java 18 Feb 2005 15:36:17 -0000 @@ -1,5 +1,5 @@ -/* TransformAttribute.java - Copyright (C) 2003 Free Software Foundation, Inc. +/* TransformAttribute.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,6 +42,13 @@ import java.io.Serializable; /** + * This class provides a mechanism for using an [EMAIL PROTECTED] AffineTransform} as + * an <i>immutable</i> attribute (for example, in the + * [EMAIL PROTECTED] java.text.AttributedString} class). Any transform passed to + * this class is copied before being stored, and any transform handed out + * by this class is a copy of the stored transform. In this way, it is + * not possible to modify the stored transform. + * * @author Michael Koch */ public final class TransformAttribute implements Serializable @@ -50,20 +57,40 @@ private AffineTransform affineTransform; + /** + * Creates a new attribute that contains a copy of the given transform. + * + * @param transform the transform (<code>null</code> not permitted). + * + * @throws IllegalArgumentException if <code>transform</code> is + * <code>null</code>. + */ public TransformAttribute (AffineTransform transform) { - if (transform != null) + if (transform == null) { - this.affineTransform = new AffineTransform (transform); + throw new IllegalArgumentException("Null 'transform' not permitted."); } + this.affineTransform = new AffineTransform (transform); } + /** + * Returns a copy of the transform contained by this attribute. + * + * @return A copy of the transform. + */ public AffineTransform getTransform () { - return affineTransform; + return (AffineTransform) affineTransform.clone(); } /** + * Returns <code>true</code> if the transform contained by this attribute is + * an identity transform, and <code>false</code> otherwise. + * + * @return <code>true</code> if the transform contained by this attribute is + * an identity transform, and <code>false</code> otherwise. + * * @since 1.4 */ public boolean isIdentity ()
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches