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

Commit 309ae32

Browse files
committed
v2: add load() stub
Signed-off-by: Alexander Bezzubov <[email protected]>
1 parent bc7f973 commit 309ae32

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

src/main/native/org_bblfsh_client_v2_Node.h

+1-1
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_libuast_Libuast.cc

+14-8
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,9 @@ JNIEXPORT jobject JNICALL Java_org_bblfsh_client_v2_libuast_Libuast_decode(
137137
return jCtxExt;
138138
}
139139

140-
JNIEXPORT void JNICALL Java_org_bblfsh_client_v2_Context_dispose(JNIEnv *env,
141-
jobject self) {
142-
ContextExt *p = getHandle<ContextExt>(env, self, "nativeContext");
143-
setHandle<ContextExt>(env, self, 0, "nativeContext");
144-
delete p;
145-
}
146-
147140
JNIEXPORT jobject JNICALL Java_org_bblfsh_client_v2_libuast_Libuast_filter(
148141
JNIEnv *, jobject, jobject, jstring) {
149-
return NULL; // TODO(bzz): implement
142+
return nullptr; // TODO(bzz): implement
150143
}
151144

152145
// v2.Context()
@@ -156,6 +149,19 @@ JNIEXPORT jobject JNICALL Java_org_bblfsh_client_v2_Context_root(JNIEnv *env,
156149
return p->RootNode();
157150
}
158151

152+
JNIEXPORT void JNICALL Java_org_bblfsh_client_v2_Context_dispose(JNIEnv *env,
153+
jobject self) {
154+
ContextExt *p = getHandle<ContextExt>(env, self, "nativeContext");
155+
setHandle<ContextExt>(env, self, 0, "nativeContext");
156+
delete p;
157+
}
158+
159+
// v2.Node()
160+
JNIEXPORT jobject JNICALL Java_org_bblfsh_client_v2_Node_load(JNIEnv *,
161+
jobject) {
162+
return nullptr; // TODO(bzz): implement
163+
}
164+
159165
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
160166
JNIEnv *env;
161167
if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_8) != JNI_OK) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.bblfsh.client.v2
2+
3+
sealed abstract class JNode
4+
case class JString(s: String) extends JNode
5+
case class JDouble(num: Double) extends JNode
6+
case class JLong(num: Long) extends JNode
7+
case class JInt(num: BigInt) extends JNode
8+
case class JBool(value: Boolean) extends JNode
9+
case class JObject(obj: List[JField]) extends JNode
10+
case class JArray(arr: List[JNode]) extends JNode
11+
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.bblfsh.client.v2
22

33
case class Node(ctx: Long, handle: Long) {
4-
// TODO(bzz) make sure single string value or an array can also be loaded
5-
@native def load(): Map[String, _]
4+
@native def load(): JNode
65
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.bblfsh.client
2+
3+
package object v2 {
4+
type JField = (String, JNode)
5+
}

0 commit comments

Comments
 (0)