Method and Field Literals

Mario Torre neugens at
Tue Nov 11 11:23:12 UTC 2014

Hi all,

Yesterday I came across a use case where having method literals would
have been very, very handy.

Before I started to play with the idea of writing up a proposal, I went
on looking for someone who already did, and it occurred to me that it
was done here:

But I'm not sure what happened to it (I'm still going through the whole
thread but it seems that the discussion just stops at some point).

I think method literals are a very nice addition.

My own use case would be to have a compile time description of a java
class. Let's make a simple example:

class SomeBean { getTimestamp() }

Map<Literal, PropertyDescriptor> descriptors =

PropertyDescriptor prop = descriptors.get(SomeBean#getTimestamp);

No more strings!

What do you think about resuming the original discussion? This seems a
very good thing to put into Java 9.


More information about the discuss mailing list