Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351175

Summary: Listener interfaces should be marked as Serializeable
Product: [RT] RAP Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: 1.5 M1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 342407    

Description Rüdiger Herrmann CLA 2011-07-05 08:32:52 EDT
Currently the listener interfaces from SWT (SelectionListener, ControlListener, etc.) do not implement Serializable. This makes things harder for applications that require their sessions to be serializable in order to provide transparent session failover. Each listener must be made Serializable in the application code. Unless the application programmer provides his/her own _serializable listeners_, anonymous listeners aren't possible any more.
Instead of writing anonymous classes like so:
  button.addSelectionListener( new SelectionListener() {
    ... 
  } );
application programmers would have to create a new interface:
  interface SerializableSelectionListener extends SelectionListener, Serializable {
  }
and then write
  button.addSelectionListener( new SerializableSelectionListener() {
    ... 
  } );

From a clustered-application-programmers point of view it would be convenient if RWT would provide serializable listeners out of the box. 
Those that aren't interested in serializable listeners would get compiler warnings like
  The serializable class XXX does not declare a static final serialVersionUID field of type long
if they stay with the default compiler settings.  

After several discussions I tend to take the 'RWT comes with serializable listeners' approach. Any other opinions?
Comment 1 Rüdiger Herrmann CLA 2011-07-09 07:03:59 EDT
org.eclipse.swt.widgets.Listener now implements Serializable
Comment 2 Rüdiger Herrmann CLA 2011-07-10 09:40:18 EDT
SWTEventListener now implements Serializable
Sorry for the compiler warnings, they will be fixed with bug 351641.