On Fri, 03 Feb 2012 08:30:31 +0100, dennis luehring <dl.so...@gmx.net> wrote:

like:

public interface test
{
   public static void blub();
}

static class test_static: test
{
   private static void blub()
   {
      int i = 10;
   }
}

int main()
{
   test_static.blub();

   return 0;
}

any idea why static could makes sense in an interface? any example?

another thing:

why can i public "blub" in the interface and private it in the class?

It's a bug of the compiler to ignore unapplicaple attributes.

http://d.puremagic.com/issues/show_bug.cgi?id=3934
http://d.puremagic.com/issues/show_bug.cgi?id=3118

http://blog.xebia.fr/2011/10/05/les->methodes-virtuelles-dextension-dans-java-8/
http://cr.openjdk.java.net/~darcy/DefenderMethods.pdf

Allowing default implementations in interfaces is a great to be able to extend interfaces without breaking dependent code and also to simplify class implementation.

If override were mandatory in implementation classes we could easily allow implementations
in interfaces.

Reply via email to