More Readable Use Site extension Methods for java

Brian Goetz brian.goetz at oracle.com
Mon Dec 6 11:52:14 PST 2010


> I propose to have use site and declaration site extension methods.

I totally understand why you would want this; there have been plenty of times 
I would have enjoyed having this tool in the toolbox too.

However, we remain opposed to use-site extension methods because we believe 
that the author of an API should remain in control of their API.  Allowing 
users to monkey-patch in new functionality to existing types undermines this 
demarcation of responsibility.

(A further problem with use-site extension methods is the lack of reflective 
discovery.  Consumers of classfiles (such as non-Java compilers like JRuby, as 
well as templating mechanism such as JSP EL) cannot easily find these 
extension methods.)

Cheers,
-Brian



More information about the lambda-dev mailing list