Request for Review : CR#8004015 : Add interface extends and defaults for basic functional interfaces
Stephen Colebourne
scolebourne at joda.org
Tue Nov 27 09:55:36 PST 2012
On 27 November 2012 17:32, Mike Duigou <mike.duigou at oracle.com> wrote:
>> It is vitally important to get this kind of formatting/style correct.
>
>> Developers the world over will be copying what the style is in these
>> classes.
>
> I totally agree that we should be consistent but I don't believe that there's a consensus yet on what good style is for these cases. What's your rationale for it being "bad style"?
These are just methods. There isn't anything different about them
other than the default keyword. They act as per a method on an
abstract class in most of the ways that a developer cares about. They
should therefore look like a normal method. Normal methods are almost
always formatted over multiple lines in java/OpenJDK:
default void foo() {
// body
}
Default method implementations are not lambdas, so no logic from
lambda syntax formatting applies here.
>> There is also no Javadoc on the default method override.
> That was intentional. The goal was to inherit from the original definition.
But where in the specification does it say what the default method
implementation does?
Sure, you can argue it is obvious, but thats not really sufficient
IMO. I proposed a clear way of expressing it in my last email.
I really want to see a form of words, such as "The default
implementation ..." or similar. That way, the rest of the world can
copy the form of words, saving learning and effort in comprehension.
It might be argued that a separate Javadoc tag could describe what the
default implementation does, but since methods in abtsract classes
don't have that, it doesn't seem necessary.
>> In this case,
>> passing a null to either parameter will result in an NPE. This should
>> be documented.
>
> Agreed. However... The following seems entirely overkill and given how these interfaces are likely to be used the javadoc will not be visible.
I don't accept that how it may be used in lambda is an excuse for lack
of documentation/specification. These are regular JDK interfaces that
can be used by anybody in any way.
BTW, my Javadoc standards are here if you didn't see it
http://blog.joda.org/2012/11/javadoc-coding-standards.html
Stephen
More information about the lambda-dev
mailing list