You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leo Donahue <do...@gmail.com> on 2014/07/03 05:11:32 UTC

Interface default methods

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?

Leo

Re: Interface default methods

Posted by Mark Thomas <ma...@apache.org>.
On 03/07/2014 21:51, Leo Donahue wrote:
> On Thu, Jul 3, 2014 at 1:05 AM, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 3 July 2014 04:11:32 GMT+01:00, Leo Donahue <do...@gmail.com>
>> 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?
> http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/Valve.java
> 
> 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
internals.

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 :)

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Interface default methods

Posted by Leo Donahue <do...@gmail.com>.
On Thu, Jul 3, 2014 at 1:05 AM, Mark Thomas <ma...@apache.org> wrote:

> On 3 July 2014 04:11:32 GMT+01:00, Leo Donahue <do...@gmail.com>
> 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?
http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/Valve.java

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.

leo

Re: Interface default methods

Posted by Mark Thomas <ma...@apache.org>.
On 3 July 2014 04:11:32 GMT+01:00, Leo Donahue <do...@gmail.com> 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



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org