Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

JVM object encode implementation #93

Merged
merged 2 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/native/jni_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ JNIEnv *getJNIEnv() {
return pEnv;
}

// Class fully qualified names
const char CLS_NODE[] = "org/bblfsh/client/v2/Node";
const char CLS_CTX[] = "org/bblfsh/client/v2/Context";
const char CLS_CTX[] = "org/bblfsh/client/v2/ContextExt";
const char CLS_OBJ[] = "java/lang/Object";
const char CLS_RE[] = "java/lang/RuntimeException";
const char CLS_JNODE[] = "org/bblfsh/client/v2/JNode";
Expand All @@ -34,6 +35,7 @@ const char CLS_JUINT[] = "org/bblfsh/client/v2/JUint";
const char CLS_JARR[] = "org/bblfsh/client/v2/JArray";
const char CLS_JOBJ[] = "org/bblfsh/client/v2/JObject";

// Method signatures
const char METHOD_JNODE_KEY_AT[] = "(I)Ljava/lang/String;";
const char METHOD_JNODE_VALUE_AT[] = "(I)Lorg/bblfsh/client/v2/JNode;";
const char METHOD_JOBJ_ADD[] =
Expand Down Expand Up @@ -126,8 +128,8 @@ jfieldID getField(JNIEnv *env, jobject obj, const char *name) {
return jfid;
}

static jmethodID MethodID(JNIEnv *env, const char *method,
const char *signature, const char *className) {
jmethodID MethodID(JNIEnv *env, const char *method, const char *signature,
const char *className) {
jclass cls = env->FindClass(className);
checkJvmException(std::string("failed to find a class ").append(className));

Expand Down Expand Up @@ -171,7 +173,7 @@ jobject ObjectMethod(JNIEnv *env, const char *method, const char *signature,
va_start(varargs, object);
jobject res = env->CallObjectMethodV(*object, mId, varargs);
va_end(varargs);
checkJvmException(std::string("failed get varargs for ")
checkJvmException(std::string("failed to get varargs for ")
.append(className)
.append(".")
.append(method));
Expand Down
1 change: 1 addition & 0 deletions src/main/native/jni_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ jint IntMethod(JNIEnv *, const char *, const char *, const char *,
jobject ObjectMethod(JNIEnv *, const char *, const char *, const char *,
const jobject *, ...);

jmethodID MethodID(JNIEnv *, const char *, const char *, const char *);
#endif
20 changes: 10 additions & 10 deletions src/main/native/org_bblfsh_client_v2_Context.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions src/main/native/org_bblfsh_client_v2_ContextExt.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading