mirror of
https://github.com/corda/corda.git
synced 2025-02-07 11:30:22 +00:00
implement Class.getEnclosingClass
This commit is contained in:
parent
85fec988d5
commit
1575b901d4
@ -1301,6 +1301,28 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
Avian_java_lang_Class_getEnclosingClass(Thread* t,
|
||||
object,
|
||||
uintptr_t* arguments)
|
||||
{
|
||||
GcClass* c
|
||||
= cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]))->vmClass();
|
||||
PROTECT(t, c);
|
||||
|
||||
GcClassAddendum* addendum = c->addendum();
|
||||
if (addendum) {
|
||||
GcByteArray* enclosingClass
|
||||
= cast<GcByteArray>(t, addendum->enclosingClass());
|
||||
|
||||
if (enclosingClass) {
|
||||
return reinterpret_cast<uintptr_t>(
|
||||
getJClass(t, resolveClass(t, c->loader(), enclosingClass)));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
Avian_java_lang_Class_getEnclosingConstructor(Thread* t,
|
||||
object method,
|
||||
|
@ -256,6 +256,9 @@ public class Reflection {
|
||||
expect(Baz.class.getField("foo").getAnnotation(Ann.class) == null);
|
||||
expect(Baz.class.getField("foo").getAnnotations().length == 0);
|
||||
|
||||
expect(new Runnable() { public void run() { } }.getClass()
|
||||
.getEnclosingClass().equals(Reflection.class));
|
||||
|
||||
expect(new Runnable() { public void run() { } }.getClass()
|
||||
.getEnclosingMethod().equals
|
||||
(Reflection.class.getMethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user