Problem with method references

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Jan 4 08:50:56 PST 2011


> This sounds like an error (in the language design).  Any expression
> that is valid in a static context should also be valid in a non-static
> context.
Hi Neal,
this surely smells bad. I double-checked with Brian, and it turns out 
that there has been a misunderstanding when we first discussed this 
feature - more specifically, there are three kinds of method references:

*) ClassName#staticMethodName - no expansion is performed by the compiler

*) ClassName#instanceMethodName - _regardless of the context being 
static or not_ prepend a synthetic argument whose type is ClassName to 
the signature of the method symbol denoted by methName

*) Expr#instanceMethodName - no expansion is performed by the compiler 
(but the expression is used as a receiver each time the method reference 
is called - a.k.a. _bound_ method references)

@Tomasz
according to the rules above (and not to the ones implemented in the 
compiler, which are buggy) your program should compile.

Maurizio





More information about the lambda-dev mailing list