mirror of
https://github.com/corda/corda.git
synced 2025-06-15 13:48:14 +00:00
various bugfixes and tweaks in reflection
This commit is contained in:
@ -68,10 +68,14 @@ public final class Array {
|
||||
break;
|
||||
case 'L':
|
||||
case '[':
|
||||
if (array.getClass().getComponentType().isInstance(value)) {
|
||||
if (value == null
|
||||
|| array.getClass().getComponentType().isInstance(value))
|
||||
{
|
||||
((Object[]) array)[index] = value;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
throw new IllegalArgumentException
|
||||
("need " + array.getClass().getComponentType() +
|
||||
", got " + value.getClass().getName());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class Field<T> extends AccessibleObject {
|
||||
}
|
||||
|
||||
public Class getType() {
|
||||
return Class.forCanonicalName(getName());
|
||||
return Class.forCanonicalName(new String(spec, 0, spec.length - 1, false));
|
||||
}
|
||||
|
||||
public Object get(Object instance) throws IllegalAccessException {
|
||||
@ -139,10 +139,11 @@ public class Field<T> extends AccessibleObject {
|
||||
break;
|
||||
|
||||
case ObjectField:
|
||||
if (getType().isInstance(value)) {
|
||||
if (value == null || getType().isInstance(value)) {
|
||||
setObject(target, offset, value);
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
throw new IllegalArgumentException
|
||||
("need " + getType() + ", got " + value.getClass().getName());
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user