PROPOSAL: Method and Field Literals

Stephen Colebourne scolebourne at joda.org
Wed Mar 11 09:18:02 PDT 2009


2009/3/11 Kevin Bourrillion <kevinb at google.com>:
>> - I believe that adding generics to Field and Method (the return type)
>> is a key part of this change.
>
> Is it possible to keep that API change and this language change orthogonal?

You could, but I believe you get real benefits from doing both together.

For existing code, everyone just adds <?>. But for new code you really
want the extra safety:

Field<Period> f = Period#ZERO;
Method<String> m = String#toUpperCase();

public void process(Method<String> method) { ... }

This allows frameworks to be specific about the type of method or
field they will accept.

Stephen



More information about the coin-dev mailing list