PROPOSAL: Method and Field Literals

Roel Spilker r.spilker at gmail.com
Thu Mar 12 07:30:25 PDT 2009


About the remaining 4000: the search did not take into account that the
proposal could only be used in cases where you now use a String literal. The
search also gives results for invocations with a String variable, for
instance names that are read from a configuration file. So that will remove
some more.

Secondly, the proposal only allows Field and Method literals that are
visible to the caller. But my experience is that I use reflection often to
access private members of other classes. So more false positives in the
search results.

Roel


On Thu, Mar 12, 2009 at 8:14 AM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:

> with getField, I only see 834 results.
>
> A search for "finally in.close", which only covers a small slice of
> ARM's bailiwick returns ~31100 results.
>
> A -lot- of the method literals in that google code search result
> involve checking if a certain method exists in a certain class. I
> would assume the module system takes care of most of these calls (as
> its effectively a version check). That should take care of about 3000
> of those 7000 already.
>
>  --Reinier Zwitserloot
>
>
>
> On Mar 12, 2009, at 08:05, Jesse Wilson wrote:
>
> > On Wed, Mar 11, 2009 at 9:48 PM, Reinier Zwitserloot <
> reinier at zwitserloot.com
> > > wrote:
> > What's this useful for, exactly? Can anyone name me one non-exotic
> > use-case?
> >
> > In Glazed Lists we have an interface called TableFormat that maps a
> > value object to its columns for a table. A concise API to access
> > methods would be convenient:
> >   TableFormat songsTableFormat = new TableFormat.Builder()
> >       .addColumn("Name", Song#getSongName())
> >       .addColumn("Track #", Song#getTrackNumber())
> >       .addColumn("Artist", Song#getArtist())
> >       .addColumn("Album", Song#getAlbum())
> >       .build();
> >
> > Google Code Search suggests another 7,000 immediate candidates:
> >
> http://www.google.com/codesearch?hl=en&lr=&q=%5C.class%5C.getMethod%5C%28%5C%22&sbtn=Search
> >
> > This includes code from Apache HTTP client, Log4J, Ant, JPA, SwingX,
> > EJB, SAX, Google Collections, GWT, Hibernate, Seam, MySQL, Equinox,
> > Eclipse... you name it.
> >
>
>
>



More information about the coin-dev mailing list