Implement Field#getGenericType()

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2013-12-03 14:08:21 -06:00
parent 0eb2d55da2
commit 2d83622975
4 changed files with 200 additions and 3 deletions

View File

@ -66,6 +66,14 @@ public class Field<T> extends AccessibleObject {
new String(vmField.spec, 0, vmField.spec.length - 1, false));
}
public Type getGenericType() {
if (vmField.addendum == null || vmField.addendum.signature == null) {
return getType();
}
String signature = Classes.toString((byte[]) vmField.addendum.signature);
return SignatureParser.parse(vmField.class_.loader, signature);
}
public Object get(Object instance) throws IllegalAccessException {
Object target;
if ((vmField.flags & Modifier.STATIC) != 0) {