Problem with method references

Stephen Colebourne scolebourne at joda.org
Fri Jan 14 02:54:52 PST 2011


On 14 January 2011 09:58, Peter Levart <peter.levart at marand.si> wrote:
> I don't know if we should allways reject #methodName in static context. Only if it refers to instance method. If it refers to static method, it should be a shourtcut for:
>
> ClassName#methodName
>
> analogous to static method invocation.

I would say that references to a static method should require the
class name. Its clearer that way.

There is a separate, and long-standing, request to add a syntax
element to refer to the current class. This is often needed in things
like logging declarations:

  private static final Logger LOG = LoggerFactory.getLogger(thisclass);

If that gets added (coin 2?) then it could be used in lambda:

  thisclass#methodName

(obviously thisclass is unlikely to be a new keyword, I use it for
example purposes)

Stephen


More information about the lambda-dev mailing list