PROPOSAL: Method and Field Literals

Adrian Kuhn akuhn at iam.unibe.ch
Thu Mar 12 01:13:05 PDT 2009


On Mar 11, 2009, at 22:47, Reinier Zwitserloot wrote:

> What's this useful for, exactly? Can anyone name me one non-exotic
> use-case?

For example, http://smallwiki.unibe.ch/jexample

Actually, any framework that calls methods with reflection will need  
this extension iff the choice of the called methods is up to the  
client. Thus, I assume this is a rather common problem.

For such framework it is very important to allow method literals in  
annotations, as suggested by Stephen Colebourne:

> - One area that needs to be added to the spec is to allow member  
> literals in annotations. Currently, annotations are defined to only  
> accept a limited subset of types that are known to be safe and  
> immutable. There is a use case for frameworks to link to methods and  
> fields from annotations (currently it is done using strings). The  
> problem is that Field/Method/Constructor are not immutable. However,  
> it has been suggested to me previously that a clone can be returned  
> each time from the annotation.

Thus, +1

cheers,
AA



More information about the coin-dev mailing list