本文整理汇总了C++中rvmFindClassUsingLoader函数的典型用法代码示例。如果您正苦于以下问题:C++ rvmFindClassUsingLoader函数的具体用法?C++ rvmFindClassUsingLoader怎么用?C++ rvmFindClassUsingLoader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rvmFindClassUsingLoader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rvmFindClassByDescriptor
Class* rvmFindClassByDescriptor(Env* env, const char* desc, ClassLoader* classLoader) {
switch (desc[0]) {
case 'Z':
return prim_Z;
case 'B':
return prim_B;
case 'C':
return prim_C;
case 'S':
return prim_S;
case 'I':
return prim_I;
case 'J':
return prim_J;
case 'F':
return prim_F;
case 'D':
return prim_D;
case 'V':
return prim_V;
case '[':
return rvmFindClassUsingLoader(env, desc, classLoader);
}
// desc[0] == 'L'
jint length = strlen(desc);
char* className = rvmAllocateMemoryAtomic(env, length - 2 + 1);
if (!className) return NULL;
strncpy(className, &desc[1], length - 2);
return rvmFindClassUsingLoader(env, className, classLoader);
}
示例2: Java_java_lang_Class_classForName
Class* Java_java_lang_Class_classForName(Env* env, Class* cls, Object* className, jboolean initializeBoolean,
ClassLoader* classLoader) {
if (!className) {
rvmThrowNullPointerException(env);
return NULL;
}
char* classNameUTF = toBinaryName(env, className);
if (!classNameUTF) return NULL;
Class* clazz = rvmFindClassUsingLoader(env, classNameUTF, classLoader);
if (!clazz) {
char* p = classNameUTF;
while (*p != '\0') {
if (*p == '/') *p = '.';
p++;
}
WARNF("Class.forName() failed to load '%s'. "
"Use the -forcelinkclasses command line option "
"or add <forceLinkClasses><pattern>%s</pattern></forceLinkClasses> "
"to your robovm.xml file to link it in.",
classNameUTF, classNameUTF);
return NULL;
}
if (initializeBoolean) {
rvmInitialize(env, clazz);
if (rvmExceptionCheck(env)) return NULL;
}
return clazz;
}
示例3: rvmInitMethods
jboolean rvmInitMethods(Env* env) {
if (rvmInitMutex(&nativeLibsLock) != 0) {
return FALSE;
}
if (rvmInitMutex(&threadStackTraceLock) != 0) {
return FALSE;
}
java_lang_StackTraceElement = rvmFindClassUsingLoader(env, "java/lang/StackTraceElement", NULL);
if (!java_lang_StackTraceElement) {
return FALSE;
}
java_lang_StackTraceElement_constructor = rvmGetInstanceMethod(env, java_lang_StackTraceElement, "<init>",
"(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V");
if (!java_lang_StackTraceElement_constructor) {
return FALSE;
}
empty_java_lang_StackTraceElement_array = rvmNewObjectArray(env, 0, java_lang_StackTraceElement, NULL, NULL);
if (!empty_java_lang_StackTraceElement_array) {
return FALSE;
}
if (!rvmAddObjectGCRoot(env, (Object*) empty_java_lang_StackTraceElement_array)) {
return FALSE;
}
return TRUE;
}
示例4: Java_java_lang_ClassCache_loadReflectionAccess
Object* Java_java_lang_ClassCache_loadReflectionAccess(Env* env, JClass* c) {
JClass* ao = rvmFindClassUsingLoader(env, "java/lang/reflect/AccessibleObject", NULL);
if (!ao) return NULL;
ClassField* f = rvmGetClassField(env, ao, "REFLECTION_ACCESS", "Lorg/robovm/rt/ReflectionAccess;");
if (!f) return NULL;
return rvmGetObjectClassFieldValue(env, ao, f);
}
示例5: rvmRun
jboolean rvmRun(Env* env) {
Options* options = env->vm->options;
Class* clazz = NULL;
clazz = rvmFindClassUsingLoader(env, options->mainClass, systemClassLoader);
if (clazz) {
Method* method = rvmGetClassMethod(env, clazz, "main", "([Ljava/lang/String;)V");
if (method) {
ObjectArray* args = rvmNewObjectArray(env, options->commandLineArgsCount, java_lang_String, NULL, NULL);
if (args) {
jint i = 0;
for (i = 0; i < args->length; i++) {
// TODO: Don't assume modified UTF-8
args->values[i] = rvmNewStringUTF(env, options->commandLineArgs[i], -1);
if (!args->values[i]) {
args = NULL;
break;
}
}
if (args) rvmCallVoidClassMethod(env, clazz, method, args);
}
}
}
Object* throwable = rvmExceptionOccurred(env);
rvmDetachCurrentThread(env->vm, TRUE);
return throwable == NULL ? TRUE : FALSE;
}
示例6: loadInterfaces
static Interface* loadInterfaces(Env* env, Class* clazz) {
ClassInfoHeader* header = lookupClassInfo(env, clazz->name,
!clazz->classLoader || !clazz->classLoader->parent ? _bcBootClassesHash : _bcClassesHash);
if (!header) return NULL;
ClassInfo ci;
jint i;
void* p = header;
readClassInfo(&p, &ci);
Interface* first = NULL;
for (i = 0; i < ci.interfaceCount; i++) {
const char* interfaceName = readInterfaceName(&p);
Class* interfaceClass = rvmFindClassUsingLoader(env, interfaceName, clazz->classLoader);
if (!interfaceClass) goto error;
Interface* interf = rvmAllocateInterface(env, interfaceClass);
if (!interf) goto error;
LL_APPEND(first, interf); // Interfaces has to be in the correct order so we need to use the slower LL_APPEND
}
return first;
error:
while (first) {
Interface* next = first->next;
rvmFreeMemoryUncollectable(env, first);
first = next;
}
return NULL;
}
示例7: rvmRun
jboolean rvmRun(Env* env) {
Options* options = env->vm->options;
Class* clazz = NULL;
rvmHookBeforeAppEntryPoint(env, options->mainClass);
clazz = rvmFindClassUsingLoader(env, options->mainClass, systemClassLoader);
if (clazz) {
Method* method = rvmGetClassMethod(env, clazz, "main", "([Ljava/lang/String;)V");
if (method) {
ObjectArray* args = rvmNewObjectArray(env, options->commandLineArgsCount, java_lang_String, NULL, NULL);
if (args) {
jint i = 0;
for (i = 0; i < args->length; i++) {
// TODO: Don't assume modified UTF-8
args->values[i] = rvmNewStringUTF(env, options->commandLineArgs[i], -1);
if (!args->values[i]) {
args = NULL;
break;
}
}
if (args) {
rvmCallVoidClassMethod(env, clazz, method, args);
}
}
}
}
return rvmDestroyVM(env->vm);
}
示例8: rvmGetSystemClassLoader
ClassLoader* rvmGetSystemClassLoader(Env* env) {
Class* holder = rvmFindClassUsingLoader(env, "java/lang/ClassLoader$SystemClassLoader", NULL);
if (!holder) return NULL;
ClassField* field = rvmGetClassField(env, holder, "loader", "Ljava/lang/ClassLoader;");
if (!field) return NULL;
return (ClassLoader*) rvmGetObjectClassFieldValue(env, holder, field);
}
示例9: createClass
static Class* createClass(Env* env, ClassInfoHeader* header, ClassLoader* classLoader) {
ClassInfo ci;
void* p = header;
readClassInfo(&p, &ci);
Class* superclass = NULL;
if (ci.superclassName) {
superclass = rvmFindClassUsingLoader(env, ci.superclassName, classLoader);
if (!superclass) return NULL;
}
rvmObtainClassLock(env);
Class* clazz = rvmAllocateClass(env, header->className, superclass, classLoader, ci.access, header->typeInfo, header->vitable, header->itables,
header->classDataSize, header->instanceDataSize, header->instanceDataOffset, header->classRefCount,
header->instanceRefCount, ci.attributes, header->initializer);
if (clazz) {
if (!rvmRegisterClass(env, clazz)) {
rvmReleaseClassLock(env);
return NULL;
}
header->clazz = clazz;
rvmHookClassLoaded(env, clazz, (void*)header);
}
rvmReleaseClassLock(env);
return clazz;
}
示例10: wrapClassNotFoundException
static void wrapClassNotFoundException(Env* env, const char* className) {
Object* exception = rvmExceptionOccurred(env);
if (exception && exception->clazz == java_lang_ClassNotFoundException) {
// If ClassNotFoundException is thrown we have to wrap it in a NoClassDefFoundError
exception = rvmExceptionClear(env);
Method* constructor = rvmGetInstanceMethod(env, java_lang_NoClassDefFoundError, "<init>", "(Ljava/lang/String;)V");
if (!constructor) return;
Object* message = rvmNewStringUTF(env, className, -1);
if (!message) return;
Object* wrappedException = rvmNewObject(env, java_lang_NoClassDefFoundError, constructor, message);
if (!wrappedException) return;
Class* java_lang_StackTraceElement = rvmFindClassUsingLoader(env, "java/lang/StackTraceElement", NULL);
if (!java_lang_StackTraceElement) return;
ObjectArray* stackTrace = rvmNewObjectArray(env, 0, java_lang_StackTraceElement, NULL, NULL);
if (!stackTrace) return;
Method* setStackTrace = rvmGetInstanceMethod(env, java_lang_Throwable, "setStackTrace", "([Ljava/lang/StackTraceElement;)V");
if (!setStackTrace) return;
rvmCallVoidInstanceMethod(env, wrappedException, setStackTrace, stackTrace);
if (rvmExceptionCheck(env)) return;
Method* initCause = rvmGetInstanceMethod(env, java_lang_NoClassDefFoundError, "initCause", "(Ljava/lang/Throwable;)Ljava/lang/Throwable;");
if (!initCause) return;
rvmCallObjectInstanceMethod(env, wrappedException, initCause, exception);
if (!rvmExceptionCheck(env)) rvmThrow(env, wrappedException);
}
}
示例11: Java_java_lang_reflect_Method_getExceptionTypes
ObjectArray* Java_java_lang_reflect_Method_getExceptionTypes(Env* env, Class* clazz, jlong methodPtr) {
Method* method = (Method*) LONG_TO_PTR(methodPtr);
Class* java_lang_reflect_Proxy = rvmFindClassUsingLoader(env, "java/lang/reflect/Proxy", NULL);
if (method->clazz->superclass == java_lang_reflect_Proxy) {
return rvmAttributeGetExceptions(env, ((ProxyMethod*) method)->proxiedMethod);
}
return rvmAttributeGetExceptions(env, method);
}
示例12: getDeclaringClassIterator
static jboolean getDeclaringClassIterator(Env* env, char* innerClass, char* outerClass, char* innerName, jint access, void* data) {
Class** result = (Class**) ((void**) data)[0];
Class* clazz = (Class*) ((void**) data)[1];
if (innerClass && outerClass && !strcmp(innerClass, clazz->name)) {
*result = rvmFindClassUsingLoader(env, outerClass, clazz->classLoader);
return FALSE; // Stop iterating
}
return TRUE; // Continue with next attribute
}
示例13: _bcLdcArrayClass
Object* _bcLdcArrayClass(Env* env, Class** arrayClassPtr, char* name) {
Class* arrayClass = *arrayClassPtr;
if (arrayClass) return (Object*) arrayClass;
ENTER;
arrayClass = rvmFindClassUsingLoader(env, name, systemClassLoader);
wrapClassNotFoundException(env, name);
if (!rvmExceptionCheck(env)) {
*arrayClassPtr = arrayClass;
}
LEAVE((Object*) arrayClass);
}
示例14: getMethodFromMethodObject
Method* getMethodFromMethodObject(Env* env, Object* methodObject) {
if (!java_lang_reflect_Method) {
java_lang_reflect_Method = rvmFindClassUsingLoader(env, "java/lang/reflect/Method", NULL);
if (!java_lang_reflect_Method) return NULL;
}
if (!java_lang_reflect_Method_method) {
java_lang_reflect_Method_method = rvmGetInstanceField(env, java_lang_reflect_Method, "method", "J");
if (!java_lang_reflect_Method_method) return NULL;
}
return (Method*) LONG_TO_PTR(rvmGetLongInstanceFieldValue(env, methodObject, java_lang_reflect_Method_method));
}
示例15: getFieldFromFieldObject
Field* getFieldFromFieldObject(Env* env, Object* fieldObject) {
if (!java_lang_reflect_Field) {
java_lang_reflect_Field = rvmFindClassUsingLoader(env, "java/lang/reflect/Field", NULL);
if (!java_lang_reflect_Field) return NULL;
}
if (!java_lang_reflect_Field_field) {
java_lang_reflect_Field_field = rvmGetInstanceField(env, java_lang_reflect_Field, "field", "J");
if (!java_lang_reflect_Field_field) return NULL;
}
return (Field*) LONG_TO_PTR(rvmGetLongInstanceFieldValue(env, fieldObject, java_lang_reflect_Field_field));
}