Static methods on interfaces

Remi Forax forax at univ-mlv.fr
Mon Dec 17 09:51:59 PST 2012


On 12/17/2012 06:49 PM, Zhong Yu wrote:
> On Mon, Dec 17, 2012 at 11:20 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
>> This is the plan of record.  If you're looking for some sort of
>> yacht-collateralized guarantee, though, we don't offer those.
>>
>> More strongly, the only way to invoke a static method on an interface is:
>>
>>      DeclaringInterfaceName.methodName(args)
>>
>> Not subinterfaces, not subclasses, not instances.
> what about import static?

works if you 'static import' the exact interface that declare the static 
method.

Rémi

>
>> On 12/17/2012 12:10 PM, Stephen Colebourne wrote:
>>> Can we (JSR-310 and more generally) rely on static methods in
>>> interfaces being in JDK8? It affects a design decision currently in
>>> progress ;-)
>>>
>>> http://mail.openjdk.java.net/pipermail/lambda-dev/2012-December/006969.html
>>>
>>> Also, can we assume that static methods are in not inherited by
>>> implementors (unlike static constants on interfaces)?
>>>
>>> Stephen
>>>



More information about the lambda-dev mailing list