One import static to rule them all

Remi Forax forax at
Wed Feb 6 16:35:29 PST 2013

On 02/07/2013 01:28 AM, Kevin Bourrillion wrote:
> I have been promised that this won't work -- that to invoke a static 
> method on an interface one /must/ refer to the exact interface it was 
> defined on, not a subtype, not an instance.  Can someone please 
> confirm this is true?

We talk about a call like Interface.staticM(), but we never talk about 
the static import explicitly.
So if someone does a static import on an interface, you suggest that the 
compiler should see only the static methods declared in the interface 
and all the static fields declared or inherited from inherited 
interfaces (for backward compat.) ?


> On Wed, Feb 6, 2013 at 4:06 PM, Remi Forax <forax at 
> <mailto:forax at>> wrote:
>     I wonder if we should not create one artificial interface that
>     extends Collector, FlatMapper, etc,
>     i.e. every interfaces that declare static methods that can be used
>     by the Stream API
>     just because it will be easier to do an import static on this
>     interface.
>     interface StaticDefaults   // better name needed
>       extends Collector<Void, Void>, FlatMapper<Void,Void> {
>     }
>     otherwise, every Java projects will define its own one.
>     cheers,
>     Rémi
> -- 
> Kevin Bourrillion | Java Librarian | Google, Inc. |kevinb at 
> <mailto:kevinb at>

More information about the lambda-libs-spec-observers mailing list