Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 281008 - EventDispatcher has abstract package private method
Summary: EventDispatcher has abstract package private method
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6.0 (Helios) RC1   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-21 10:44 EDT by Kristian Duske CLA
Modified: 2010-05-17 10:40 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kristian Duske CLA 2009-06-21 10:44:23 EDT
The abstract class org.eclipse.draw2d.EventDispatcher has a method (IFigure getFocusOwner();) which is at the same time abstract and package private. This forces all subclasses of EventDispatcher to reside in the same package as EventDispatcher itself, which is very inconvenient and doesn't seem to serve any purpose at all.

I propose to make this public.
Comment 1 Kristian Duske CLA 2009-06-21 13:17:17 EDT
Come to think of it, why is EventDispatcher not an interface, anyway?
Comment 2 Kristian Duske CLA 2009-06-21 13:53:59 EDT
Making things worse, EventDispatcher has a protected abstract method that gets called from outside of EventDispatchers inheritance hierarchy (by client classes like Figure).

Consider the following scenario: I'm writing a subclass of EventDispatcher that I put in a package callled org.eclipse.draw2d in my plugin project. My EventDispatcher subclass should delegate all method calls to a delegate event dispatcher (some subclass of EventDispatcher).

But I cannot delegate EventDispatcher#updateCursor() because even though my event dispatcher subclass is in the same package as the EventDispatcher class itself, my event dispatcher and the delegate dispatcher are loaded by different class loaders, which according to the VM specs prohibits accessing protected methods / fields across classloader boundaries. So I get the following runtime error:

(class: org/eclipse/draw2d/EventDispatcher3D, method: updateCursor signature: ()V) Bad access to protected data

This makes it impossible to write any delegating event dispatcher. Now I have to subclass EventDomainDispatcher, which, if EventDispatcher were and interface (or had only public methods), would not be neccessary at all (and makes my code vulnerable to all problems that subclassing introduces).
Comment 3 Jens Von Pilgrim CLA 2010-03-20 15:32:08 EDT
Things are getting worse in current GEF 3.6 version as described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=306609

Jens
Comment 4 Anthony Hunter CLA 2010-03-20 19:38:28 EDT
Will investigate for 3.6 M7.
Comment 5 Anthony Hunter CLA 2010-05-03 13:10:19 EDT
We released 3.6 M7 today so moving unresolved bugs to 3.6 RC1.

We need to re-access if we can complete these for Helios.
Comment 6 Anthony Hunter CLA 2010-05-17 10:40:54 EDT
(In reply to comment #0)
> The abstract class org.eclipse.draw2d.EventDispatcher has a method (IFigure
> getFocusOwner();) which is at the same time abstract and package private. This
> forces all subclasses of EventDispatcher to reside in the same package as
> EventDispatcher itself, which is very inconvenient and doesn't seem to serve
> any purpose at all.
> 
> I propose to make this public.

This method is now public. See Bug 241767 .