The class java.awt.AWTEvent contains a package-private variable 'next'.
This variable seems to have been added in order to allow
java.awt.EventQueue to use AWTEvent as a C-style linked list.
The attatched diff replaces that approach with a private instance of
java.util.LinkedList.
Ian
Index: java/awt/EventQueue.java
===================================================================
RCS file: /cvs/classpath/java/awt/EventQueue.java,v
retrieving revision 1.4
diff -r1.4 EventQueue.java
22a23,26
> import java.util.LinkedList;
> import java.util.ListIterator;
> import java.util.NoSuchElementException;
>
37,39c41,43
< // The queue. We added a package protected field to AWTEvent to make it
< // a convenient linked list.
< private AWTEvent queue;
---
> // The queue. Use a java LinkedList instead of the Classpath-specific hack
>
> private LinkedList queue = new LinkedList();
72,82c76,77
< if (queue == null)
< queue = event;
< else
< {
< AWTEvent end = queue;
< while (end.next != null)
< end = end.next;
<
< end.next = queue;
< }
< notify();
---
> queue.addLast(event);
> notify();
101,108c96,103
< if (queue != null)
< {
< AWTEvent evt = queue;
< queue = queue.next;
< evt.next = null;
< return(evt);
< }
< wait();
---
> try
> {
> return (AWTEvent)queue.removeFirst();
> }
> catch (NoSuchElementException nsee)
> {
> wait();
> }
126,134d120
< if (queue != null)
< {
< // We are taking a chance that the user doesn't repost the same
< // event back to the queue, but AWTEvent isn't cloneable so we
< // don't have much choice. If this becomes a problem we'll have
< // to write a wrapper class for enqueuing.
< return(queue);
< }
<
136,139c122,131
< {
< wait();
< }
< catch(InterruptedException e) { }
---
> {
> return (AWTEvent)queue.getFirst();
> }
> catch (NoSuchElementException nsee)
> {
> try {
> wait();
> }
> catch (InterruptedException ie) { }
> }
157a150
>
160,169c153,160
< if (queue != null)
< {
< AWTEvent evt = queue;
< while (evt != null)
< {
< if (evt.getID() == id)
< return(evt);
< evt = evt.next;
< }
< }
---
> ListIterator iter = queue.listIterator(0);
>
> while(iter.hasNext())
> {
> AWTEvent evt = (AWTEvent)iter.next();
> if (evt.getID() == id)
> return evt;
> }