[cp-patches] FYI: Gtk peer generics and cleanup

Mark Wielaard mark at klomp.org
Thu Apr 5 11:32:20 UTC 2007


Hi Francis,

On Mon, 2007-02-12 at 16:38 -0500, Francis Kung wrote:
> This patch adds generics to the GTK peers, and cleans up the formatting 
> throughout the peers (using spaces vs indents, etc).

This part seems wrong:

> diff -u -r1.99 GtkToolkit.java
> --- gnu/java/awt/peer/gtk/GtkToolkit.java       3 Jan 2007 22:51:07 -0000       1.99
> +++ gnu/java/awt/peer/gtk/GtkToolkit.java       12 Feb 2007 20:56:30 -0000
> [...]
> @@ -621,11 +623,10 @@
>      return new GtkDragSourceContextPeer(e);
>    }
>    
> -  public DragGestureRecognizer createDragGestureRecognizer(Class recognizer,
> -                                                           DragSource ds,
> -                                                           Component comp,
> -                                                           int actions,
> -                                                           DragGestureListener l)
> +  public <T extends DragGestureRecognizer> T
> +  createDragGestureRecognizer(Class<T> recognizer, DragSource ds, 
> +                              Component comp, int actions,
> +                              DragGestureListener l)
>    {
>      if (recognizer.getName().equals("java.awt.dnd.MouseDragGestureRecognizer")
>          && ! GraphicsEnvironment.isHeadless())
> @@ -633,7 +634,8 @@
>          GtkMouseDragGestureRecognizer gestureRecognizer
>            = new GtkMouseDragGestureRecognizer(ds, comp, actions, l);
>          gestureRecognizer.registerListeners();
> -        return gestureRecognizer;
> +        recognizer.asSubclass(gestureRecognizer.getClass());
> +        return recognizer.cast(gestureRecognizer);
>        }
>      else
>        {

There are some mauve failures and the gnu.classpath.examples.awt.Demo
from examples/examples.zip doesn't start anymore:

Exception in thread "main" java.lang.ClassCastException
   at java.lang.Class.asSubclass(Class.java:1304)
   at gnu.java.awt.peer.gtk.GtkToolkit.createDragGestureRecognizer(GtkToolkit.java:637)
   at java.awt.dnd.DragSource.createDragGestureRecognizer(DragSource.java:235)
   at java.awt.dnd.DragSource.createDefaultDragGestureRecognizer(DragSource.java:244)
   at gnu.classpath.examples.awt.Demo$DragDropWindow$DragLabel.<init>(Demo.java:946)
   at gnu.classpath.examples.awt.Demo$DragDropWindow.<init>(Demo.java:867)
   at gnu.classpath.examples.awt.Demo$MainWindow.<init>(Demo.java:218)
   at gnu.classpath.examples.awt.Demo.main(Demo.java:92)

Could you take a look?

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20070405/6930c036/attachment-0001.pgp


More information about the Classpath-patches mailing list