"default" keyword inconsistency: *before* default methods in interfaces, *after* default attributes in annotations

Rogerio Liesenfeld rliesenfeld at gmail.com
Fri Feb 8 06:42:42 PST 2013


In lambda_b75, I noticed that the “default” keyword is being used
*before* the method name in default method declarations inside
This contradicts current usage of the same keyword in annotation
types, where it must appear *after* the method name. This is since
Java 5.

For example, consider the following annotation type declaration:

public @interface RequestForEnhancement {
    int    id();
    String engineer() default "[unassigned]";

Attributes like “engineer” above are similar to default methods such as:

public interface RequestForEnhancement {
    int    id();
    default String engineer(){ return "[unassigned]"; }

It would be more consistent with “default” after the method.

More information about the lambda-dev mailing list