<AWT Dev> Proposal: make all methods in all listeners default.

Petr Pchelko petr.pchelko at oracle.com
Thu Jan 16 06:27:05 PST 2014

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.

More information about the awt-dev mailing list