@@ -15,6 +15,8 @@ jobject asJvmBuffer(uast::Buffer buf) {
15
15
return env->NewDirectByteBuffer (buf.ptr , buf.size );
16
16
}
17
17
18
+ const char *nativeContext = " nativeContext" ;
19
+
18
20
jfieldID getHandleField (JNIEnv *env, jobject obj, const char *name) {
19
21
jclass cls = env->GetObjectClass (obj);
20
22
if (env->ExceptionOccurred () || !cls) {
@@ -145,22 +147,22 @@ JNIEXPORT jobject JNICALL Java_org_bblfsh_client_v2_libuast_Libuast_filter(
145
147
// v2.Context()
146
148
JNIEXPORT jobject JNICALL Java_org_bblfsh_client_v2_Context_root (JNIEnv *env,
147
149
jobject self) {
148
- ContextExt *p = getHandle<ContextExt>(env, self, " nativeContext" );
150
+ ContextExt *p = getHandle<ContextExt>(env, self, nativeContext);
149
151
return p->RootNode ();
150
152
}
151
153
152
154
JNIEXPORT jobject JNICALL Java_org_bblfsh_client_v2_Context_encode (
153
155
JNIEnv *env, jobject self, jobject node) {
154
156
UastFormat fmt = UAST_BINARY; // TODO(bzz): make it argument & enum
155
157
156
- ContextExt *p = getHandle<ContextExt>(env, self, " nativeContext" );
158
+ ContextExt *p = getHandle<ContextExt>(env, self, nativeContext);
157
159
return p->Encode (node, fmt);
158
160
}
159
161
160
162
JNIEXPORT void JNICALL Java_org_bblfsh_client_v2_Context_dispose (JNIEnv *env,
161
163
jobject self) {
162
- ContextExt *p = getHandle<ContextExt>(env, self, " nativeContext" );
163
- setHandle<ContextExt>(env, self, 0 , " nativeContext" );
164
+ ContextExt *p = getHandle<ContextExt>(env, self, nativeContext);
165
+ setHandle<ContextExt>(env, self, 0 , nativeContext);
164
166
delete p;
165
167
}
166
168
0 commit comments