On Fri, Sep 12, 2014 at 3:13 PM, Tommaso Teofili <[email protected]> wrote: > > > > 2014-09-12 21:11 GMT+02:00 Robert Muir <[email protected]>: >> >> On Fri, Sep 12, 2014 at 2:39 PM, Chris Hostetter >> <[email protected]> wrote: >> > >> > : faster. And there are a ton of features that would make our lives as >> > : developers easier (and that can improve the quality of Lucene 5 when >> > : it is eventually released). >> > >> > Examples please? >> > >> > >> >> The ability to specify default methods on interfaces. > > > which I, by the way, find awful ... however +1 >
I thought it was awful myself too, but sometimes its appropriate. For example, I am currently working on a patch to allow you to gain insight into what is going on with lucene datastructures, how much memory are they using, etc. With java8, i could add a default method to interface Accountable "getChildResources" that returns the empty list, along with some static sugar methods to e.g. ease implementations and so on. This would be a relatively small patch, wouldn't introduce useless noise anywhere, would be easy for people to use, and it wouldnt break backwards compatibility. With java7, there are less choices. I can introduce a new method to the interface (breaking it, and requiring lots of Collections.emptyList impls everywhere), and a separate Accountables with just static methods, thats one option. Alternatively, i can introduce a new (sub)interface, but that makes the API more complex and much more difficult to use, e.g. instanceof casts and so on, and you still need a separate class for the other stuff. I only use this example because it is something I am currently working on and it frustrates me. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
