Method reference double-colon syntax

Sven Efftinge sven at efftinge.de
Thu May 31 00:04:32 PDT 2012


On May 31, 2012, at 4:43 AM, Brian Goetz wrote:

> With the change in lambda syntax to one that does not use a #, the first 
> no longer applies.  The Javadoc justification is in actuality pretty 
> weak; I would hazard that only a few percent of Java developers have 
> used it, and if you quizzed developers on "what is the pound symbol used 
> for in Java", most would say "nothing".  The Javadoc use is more of a 
> post-hoc justification than a real reason to choose it.

At least in the teams I have worked with everybody reads JavaDoc a lot. It's an important part of the language.

Another way to use the # in a future release would be to introduce literals for members of classes.

I.e. 'String#length' would be an expression of type java.lang.reflect.Method. This would also be more in line with
how the # is used in JavaDoc. Unfortunately people would get confused by the subtile differences between method literals and a method references.

Sven


More information about the lambda-dev mailing list