PROPOSAL: Method and Field Literals (original) (raw)

Noel Grandin noel at peralex.com
Thu Mar 12 02:37:10 PDT 2009


Stephen Colebourne wrote:

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

public void process(Method method) { ... } This allows frameworks to be specific about the type of method or field they will accept.

I can see the benefit for Field, but for Method I think you're wasting your time.

Frameworks will be more interested in the parameters of a method rather then return type, but I can't see any way of encoding that into the generic parameters, because we can't do a variable number of type parameters.

I would rather leave Method as a raw type, possibly something to solve in the future when Java's generic type system becomes more powerful :-)

Regards, Noel Grandin

Disclaimer: http://www.peralex.com/disclaimer.html



More information about the coin-dev mailing list