At first glance, this is sensible because of the first-class status in
the JLS of record components and their mapping to accessors.
Based on a check of other implementations of AnnotatedElement, consider
`boolean isVarArgs()` (IIRC a varargs component will be allowed) and
`String toGenericString()`.
Alex
On 9/24/2019 12:05 PM, Vicente Romero wrote:
Hi amber experts,
We are considering our next move in the reflection area for records. It
will be hoisting record components to a first class status in the
reflection engine. Our current proposal is to define a new class named:
java.lang.reflect.RecordComponent which will will be roughly defined as:
public final class RecordComponent implements AnnotatedElement {
private String name;
private Class<?> type;
private Method accessor;
public String getName() { return name; }
public Class<?> getType() { return type; }
public Type getGenericType() {...}
public AnnotatedType getAnnotatedType() {....}
public Method getAccessor() { return accessor; }
}
Along with this change we are also proposing changes to java.lang.Class.
Our proposal there is to remove current method:
java.lang.Class::getRecordAccessors and add a new method named:
java.lang.Class::getRecordComponents which will return a array of
java.lang.reflect.RecordComponents. Thanks in advance for sharing any
feedback on this proposal,
Vicente