Default methods syntax survey

Lukas Eder lukas.eder at
Tue Aug 7 08:49:58 PDT 2012

> Here is a one-question syntax survey on default methods for Java SE 8:
> Feel free to republish elsewhere; survey will close on Friday of this week.

Since opinions on the position of "default" are welcome, I hope it's
not spam if I ask again, why option 3 is not an option:

1.  void foo() default {

2.  default void foo() {

3.  void foo() {

The survey question states the following:

>  in the same way we can have static methods, abstract methods, etc, and the keyword takes the same place as abstract or static would. Which feels more natural?

I feel that the "default" keyword doesn't feel very natural at all.
The fact that the method has a body is expressive enough to indicate
that it is a "default" method. Classes don't have default methods
either, although class methods behave in similar ways as default
methods... I know that "final" is out of scope for Java 8, just like
"static". Yet, thinking about "final default" or "default final" or
"static default" really doesn't feel natural.

After this, I promise, I won't try my luck again on having default removed :-)

More information about the lambda-dev mailing list