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

Commit 4d36047

Browse files
committed
filter: minor cleanup
Signed-off-by: Alexander Bezzubov <[email protected]>
1 parent ea0de83 commit 4d36047

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/main/native/org_bblfsh_client_v2_libuast_Libuast.cc

+2-5
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,10 @@ Java_org_bblfsh_client_v2_libuast_Libuast_00024UastIter_nativeInit(
645645
JNIEXPORT void JNICALL
646646
Java_org_bblfsh_client_v2_libuast_Libuast_00024UastIter_nativeDispose(
647647
JNIEnv *env, jobject self) {
648-
// FIXME:
649-
// either delete iff .nativeInit() was called
650-
// or never delete it, so client should do that instead
651-
// this.ctx - delete the Context as iterator owns it
648+
// this.ctx - delete as iterator owns it for both .iterate()/.filter() cases
652649
auto ctx = getHandle<Context>(env, self, "ctx");
653-
setHandle<Context>(env, self, 0, "ctx");
654650
delete (ctx);
651+
setHandle<Context>(env, self, 0, "ctx");
655652

656653
// this.iter
657654
auto iter = getHandle<uast::Iterator<Node *>>(env, self, "iter");

src/test/scala/org/bblfsh/client/v2/BblfshClientUastApiTest.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class BblfshClientUastApiTest extends BblfshClientBaseTest {
7878
}
7979

8080
"XPath query" should "filter native UAST" in {
81-
val uast = resp.uast.decode().root()
81+
val uast: NodeExt = resp.uast.decode().root()
8282
val it = BblfshClient.filter(uast, "//uast:Position")
8383

8484
it.hasNext should be(true)
@@ -90,7 +90,7 @@ class BblfshClientUastApiTest extends BblfshClientBaseTest {
9090

9191
"XPath query" should "filter managed UAST" in {
9292
val ctx = resp.uast.decode()
93-
val uast = ctx.root().load()
93+
val uast: JNode = ctx.root().load()
9494
ctx.dispose()
9595

9696
val it = BblfshClient.filter(uast, "//uast:Position")
@@ -101,9 +101,9 @@ class BblfshClientUastApiTest extends BblfshClientBaseTest {
101101
it.close()
102102
it.hasNext should be(false)
103103
}
104-
104+
105105
"XPath query" should "work another thread" in {
106-
val ctx = resp.uast.decode()
106+
val ctx: ContextExt = resp.uast.decode()
107107
val root = ctx.root()
108108
val th = new Thread(new Runnable {
109109
def run() {

0 commit comments

Comments
 (0)