Method and Field Literals
Brian Goetz
brian.goetz at oracle.com
Tue Nov 11 11:28:39 UTC 2014
Method and field literals came up during lambda. (As did method handle literals ). The upshot was that while we did not dislike them, they were sufficiently distant from the lambda mission that, when the inevitable need to cut scope made its appearance, they didn't make the cut. But they are on the list of features to b considered.
Sent from my iPhone
> On Nov 11, 2014, at 12:23 PM, Mario Torre <neugens at redhat.com> wrote:
>
> 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:
>
> http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000388.html
>
> 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 =
> SomeBeanUtility.createDescriptors(SomeBean.class);
>
> 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.
>
> Cheers,
> Mario
>
>
>
More information about the discuss
mailing list