Proposal: make all methods in all listeners default. (original) (raw)
Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Thu Jan 30 10:45:21 UTC 2014
- Previous message: Proposal: make all methods in all listeners default.
- Next message: JDK 9 RFR of JDK-8032047: Fix static lint warnings in client libraries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Suppose there is a class that extends an adapter and an another class that implements an interface with default methods. Are there any difference between these classes usage (method invocation time, class file size and so on)?
If all AWT/Swing listeners are have default methods does it have sense to add one interface that will extend all of them, so there is no need to list all interfaces in my class like: class MyPanel implements KeyListener, MouseListener, MouseMotionListener ...
Thanks, Alexandr.
On 1/16/2014 6:27 PM, Petr Pchelko wrote:
Hello, AWT and Swing Team.
I want to discuss an idea with you. What do you think making almost all methods in all listener interfaces in Swing and AWT default with empty implementation, the same way it's done in adapters? This would be convenient if we are writing something like this: public class MyPanel extends Panel implements MouseListener but do not need all methods in a MouseListener. So, without this change we would need to override the methods with empty implementation ourselves, and if all of the methods are default we can choose which methods to implement. Actually, if done like this we could take one step further and deprecate adapters.. What do you think? With best regards. Petr.
- Previous message: Proposal: make all methods in all listeners default.
- Next message: JDK 9 RFR of JDK-8032047: Fix static lint warnings in client libraries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]