tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: Interface default methods
Date Thu, 03 Jul 2014 21:11:17 GMT
On 03/07/2014 21:51, Leo Donahue wrote:
> On Thu, Jul 3, 2014 at 1:05 AM, Mark Thomas <> wrote:
>> On 3 July 2014 04:11:32 GMT+01:00, Leo Donahue <>
>> wrote:
>>> I don't want to start a war, but just curious if the Tomcat developers
>>> see
>>> any use case for adding default methods to any of the Interfaces in the
>>> API?
>> Which API?
>> Mark
> Well, for example, this Interface?
> I was just curious if the Tomcat developers have any intent on creating
> default methods in Interfaces such as this one as opposed to using the
> abstract class ValveBase.
> Just wanted to know how people felt about Interface default methods in
> general.

OK. We are talking about Tomcat's API that folks might use / Tomcat

Personally, I'm in favour of anything that enables us to write cleaner,
easier to maintain code. On that basis I guess I'd be happy to use them
where it made sense.

The obvious use case is when we add a new method to an interface. A
default method will enable to do this with a lower chance of causing
problems for folks using the interface.

In terms of using them instead of abstract classes, I think it depends.
There are times when having a final method in that base class is useful
- something I don't think you can do in an interface default method (I
could be wrong here).

When it comes to the existing code, I don't (currently) see a reason to
refactor the current abstract classes into interface default methods as
a standalone task. What I think is more likely is when a code section is
being refactored for some reason, interface default methods are another
tool that folks will consider when doing that refactoring.

All of this is, of course, dependent on the Servlet EG mandating a
minimum Java version that supports interface default methods for the
next spec release (which I think is pretty likely).

One thing to keep in mind: other committer opinions are available :)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message