mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
Implement Method#getDefaultValue()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
ff323d46a3
commit
58ec623d7a
@ -450,6 +450,25 @@ public class Classes {
|
||||
return (Annotation) a[0];
|
||||
}
|
||||
|
||||
public static Object getAnnotationDefaultValue(ClassLoader loader,
|
||||
MethodAddendum addendum) {
|
||||
if (addendum == null) {
|
||||
return null;
|
||||
}
|
||||
byte[] annotationDefault = (byte[]) addendum.annotationDefault;
|
||||
if (annotationDefault == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return parseAnnotationValue(loader, addendum.pool,
|
||||
new ByteArrayInputStream(annotationDefault));
|
||||
} catch (IOException e) {
|
||||
AssertionError error = new AssertionError();
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
public static native Method makeMethod(Class c, int slot);
|
||||
|
||||
private static native void acquireClassLock();
|
||||
|
@ -142,4 +142,9 @@ public class Method<T> extends AccessibleObject implements Member {
|
||||
public boolean isVarArgs() {
|
||||
return (getModifiers() & 0x80) != 0;
|
||||
}
|
||||
|
||||
public Object getDefaultValue() {
|
||||
ClassLoader loader = getDeclaringClass().getClassLoader();
|
||||
return Classes.getAnnotationDefaultValue(loader, vmMethod.addendum);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user