本文整理汇总了C++中rvmFindClassUsingLoader函数的典型用法代码示例。如果您正苦于以下问题:C++ rvmFindClassUsingLoader函数的具体用法?C++ rvmFindClassUsingLoader怎么用?C++ rvmFindClassUsingLoader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rvmFindClassUsingLoader函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:John-Chan,项目名称:robovm,代码行数:30,代码来源:class.c
示例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;
}
开发者ID:Andorion,项目名称:robovm,代码行数:29,代码来源:java_lang_Class.c
示例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;
}
开发者ID:Svyatoslavik,项目名称:robovm,代码行数:26,代码来源:method.c
示例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);
}
开发者ID:MichaelFreimueller,项目名称:robovm,代码行数:7,代码来源:java_lang_ClassCache.c
示例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;
}
开发者ID:John-Chan,项目名称:robovm,代码行数:27,代码来源:init.c
示例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;
}
开发者ID:SinoJerk,项目名称:robovm,代码行数:28,代码来源:bc.c
示例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);
}
开发者ID:rover12421,项目名称:robovm,代码行数:29,代码来源:init.c
示例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);
}
开发者ID:John-Chan,项目名称:robovm,代码行数:7,代码来源:class.c
示例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;
}
开发者ID:SinoJerk,项目名称:robovm,代码行数:30,代码来源:bc.c
示例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);
}
}
开发者ID:SinoJerk,项目名称:robovm,代码行数:25,代码来源:bc.c
示例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);
}
开发者ID:bugvm,项目名称:bugvm,代码行数:8,代码来源:java_lang_reflect_Method.c
示例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
}
开发者ID:Zubnix,项目名称:aura,代码行数:9,代码来源:attribute.c
示例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);
}
开发者ID:SinoJerk,项目名称:robovm,代码行数:11,代码来源:bc.c
示例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));
}
开发者ID:Arcnor,项目名称:robovm,代码行数:11,代码来源:reflection_helpers.c
示例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));
}
开发者ID:Arcnor,项目名称:robovm,代码行数:11,代码来源:reflection_helpers.c
示例16: Java_java_lang_Class_getEnclosingMethod
Object* Java_java_lang_Class_getEnclosingMethod(Env* env, Class* thiz) {
Method* method = rvmAttributeGetEnclosingMethod(env, thiz);
if (!method || METHOD_IS_CONSTRUCTOR(method)) return NULL;
Class* jlr_Method = rvmFindClassUsingLoader(env, "java/lang/reflect/Method", NULL);
if (!jlr_Method) return NULL;
Method* constructor = rvmGetInstanceMethod(env, jlr_Method, "<init>", "(J)V");
if (!constructor) return NULL;
jvalue args[1];
args[0].j = PTR_TO_LONG(method);
return rvmNewObjectA(env, jlr_Method, constructor, args);
}
开发者ID:Andorion,项目名称:robovm,代码行数:11,代码来源:java_lang_Class.c
示例17: getEnclosingMethodIterator
static jboolean getEnclosingMethodIterator(Env* env, char* className, char* methodName, char* methodDesc, void* data) {
Method** result = (Method**) ((void**) data)[0];
Class* clazz = (Class*) ((void**) data)[1];
if (methodName && methodDesc) {
Class* c = rvmFindClassUsingLoader(env, className, clazz->classLoader);
if (c) {
*result = rvmGetMethod(env, c, methodName, methodDesc);
}
return FALSE; // Stop iterating
}
return TRUE; // Continue with next attribute
}
开发者ID:Zubnix,项目名称:aura,代码行数:12,代码来源:attribute.c
示例18: throwSocketExceptionErrno
static void throwSocketExceptionErrno(Env* env, int errnum) {
char message[512];
JClass* exCls = rvmFindClassUsingLoader(env, "java/net/SocketException", NULL);
if (!exCls) {
return;
}
if (strerror_r(errnum, message, 512) == 0) {
rvmThrowNew(env, exCls, message);
} else {
rvmThrowNew(env, exCls, NULL);
}
}
开发者ID:MichaelFreimueller,项目名称:robovm,代码行数:12,代码来源:java_net_NetworkInterface.c
示例19: ldcClass
static Class* ldcClass(Env* env, ClassInfoHeader* header) {
Class* clazz = header->clazz;
if (!clazz) {
ClassLoader* loader = NULL;
if (lookupClassInfo(env, header->className, _bcClassesHash) == header) {
loader = systemClassLoader;
}
clazz = rvmFindClassUsingLoader(env, header->className, loader);
if (!clazz) wrapClassNotFoundException(env, header->className);
}
return clazz;
}
开发者ID:SinoJerk,项目名称:robovm,代码行数:12,代码来源:bc.c
示例20: rvmInitAttributes
jboolean rvmInitAttributes(Env* env) {
java_lang_TypeNotPresentException = rvmFindClassUsingLoader(env, "java/lang/TypeNotPresentException", NULL);
if (!java_lang_TypeNotPresentException) return FALSE;
java_lang_annotation_AnnotationFormatError = rvmFindClassUsingLoader(env, "java/lang/annotation/AnnotationFormatError", NULL);
if (!java_lang_annotation_AnnotationFormatError) return FALSE;
java_lang_reflect_Method = rvmFindClassUsingLoader(env, "java/lang/reflect/Method", NULL);
if (!java_lang_reflect_Method) return FALSE;
java_lang_reflect_Method_init = rvmGetInstanceMethod(env, java_lang_reflect_Method, "<init>", "(J)V");
if (!java_lang_reflect_Method_init) return FALSE;
java_lang_annotation_Annotation = rvmFindClassUsingLoader(env, "java/lang/annotation/Annotation", NULL);
if (!java_lang_annotation_Annotation) return FALSE;
array_of_java_lang_annotation_Annotation = rvmFindClassUsingLoader(env, "[Ljava/lang/annotation/Annotation;", NULL);
if (!array_of_java_lang_annotation_Annotation) return FALSE;
Class* array_java_lang_Class = rvmFindClassUsingLoader(env, "[Ljava/lang/Class;", NULL);
if (!array_java_lang_Class) return FALSE;
emptyExceptionTypes = rvmNewObjectArray(env, 0, NULL, array_java_lang_Class, NULL);
if (!emptyExceptionTypes) return FALSE;
if (!rvmAddGlobalRef(env, (Object*) emptyExceptionTypes)) return FALSE;
emptyAnnotations = rvmNewObjectArray(env, 0, NULL, array_of_java_lang_annotation_Annotation, NULL);
if (!emptyAnnotations) return FALSE;
if (!rvmAddGlobalRef(env, (Object*) emptyAnnotations)) return FALSE;
return TRUE;
}
开发者ID:Andorion,项目名称:robovm,代码行数:27,代码来源:attribute.c
注:本文中的rvmFindClassUsingLoader函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论