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

Commit 2d844e9

Browse files
authored
Merge pull request #93 from bzz/load-impl-encode
JVM object encode implementation
2 parents 5b81fbb + 54ea17b commit 2d844e9

11 files changed

+266
-128
lines changed

src/main/native/jni_utils.cc

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ JNIEnv *getJNIEnv() {
2020
return pEnv;
2121
}
2222

23+
// Class fully qualified names
2324
const char CLS_NODE[] = "org/bblfsh/client/v2/Node";
24-
const char CLS_CTX[] = "org/bblfsh/client/v2/Context";
25+
const char CLS_CTX[] = "org/bblfsh/client/v2/ContextExt";
2526
const char CLS_OBJ[] = "java/lang/Object";
2627
const char CLS_RE[] = "java/lang/RuntimeException";
2728
const char CLS_JNODE[] = "org/bblfsh/client/v2/JNode";
@@ -34,6 +35,7 @@ const char CLS_JUINT[] = "org/bblfsh/client/v2/JUint";
3435
const char CLS_JARR[] = "org/bblfsh/client/v2/JArray";
3536
const char CLS_JOBJ[] = "org/bblfsh/client/v2/JObject";
3637

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

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

@@ -171,7 +173,7 @@ jobject ObjectMethod(JNIEnv *env, const char *method, const char *signature,
171173
va_start(varargs, object);
172174
jobject res = env->CallObjectMethodV(*object, mId, varargs);
173175
va_end(varargs);
174-
checkJvmException(std::string("failed get varargs for ")
176+
checkJvmException(std::string("failed to get varargs for ")
175177
.append(className)
176178
.append(".")
177179
.append(method));

src/main/native/jni_utils.h

+1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ jint IntMethod(JNIEnv *, const char *, const char *, const char *,
4444
jobject ObjectMethod(JNIEnv *, const char *, const char *, const char *,
4545
const jobject *, ...);
4646

47+
jmethodID MethodID(JNIEnv *, const char *, const char *, const char *);
4748
#endif

src/main/native/org_bblfsh_client_v2_Context.h

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/native/org_bblfsh_client_v2_ContextExt.h

+45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)