Hello,

Sending along some responses to these questions from Alex:

On 8/25/2013 7:03 AM, Kasper Nielsen wrote:
Hi,

just 2 short questions/commons on java.lang.reflect.Parameter

1)
I was wondering if there is any reason for java.lang.reflect.Parameter not
to expose the index field?

"Not sure what you mean by the "index field", but if you mean the name_index item in the MethodParameters attribute, then it is possible to know whether it's zero by calling Parameter#isNamePresent."


2)
Also, while Parameter.getParameterizedType() might be a better name than
getGenericType().
I find it kind of annoying that it is called Field.getGenericType() but
Parameter.getParameterizedType(). Lets just have the same name for
practically the same functionality?


"Yes and no. First, the historic use of getGenericXXX in java.lang.reflect is wrong (it should be getParameterizedXXX) but it can't be changed now. The Language Model API in javax.lang.model.** is much better with terminology. Second, when we add methods to existing java.lang.reflect types, we hold our noses and use "Generic" for consistency, e.g., the new AnnotatedArrayType interface for type annotations has a method getAnnotatedGenericComponentType that is consistent with the getGenericComponentType method in GenericArrayType. Third, when we add new types to java.lang.reflect, we use the correct terminology, hence Parameter#getParameterizedType."

HTH,

-Joe

Reply via email to