Hey,
This patch fixes a Harmony Test that was failing on Classpath. We now
generate the canvas name in the same manner as Sun. If someone could
please approve/comment on this patch, that would be great.
2006-07-06 Tania Bento <[EMAIL PROTECTED]>
* gnu/java/awt/Canvas.java
Added new private variable 'next_canvas_number".
(generateName): Added.
(getUniqueLong): Added.
Thanks,
Tania
Index: java/awt/Canvas.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Canvas.java,v
retrieving revision 1.16
diff -u -r1.16 Canvas.java
--- java/awt/Canvas.java 27 Sep 2005 18:27:45 -0000 1.16
+++ java/awt/Canvas.java 6 Jul 2006 16:15:27 -0000
@@ -68,6 +68,11 @@
* Compatible with Sun's JDK.
*/
private static final long serialVersionUID = -2284879212465893870L;
+
+ /**
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_canvas_number;
/**
* The graphics configuration associated with the canvas.
@@ -343,4 +348,19 @@
/* Call the paint method */
paint(graphics);
}
+
+ /**
+ * Generate a unique name for this canvas.
+ *
+ * @return A unique name for this canvas.
+ */
+ String generateName()
+ {
+ return "canvas" + getUniqueLong();
+ }
+
+ private static synchronized long getUniqueLong()
+ {
+ return next_canvas_number++;
+ }
}