summaryrefslogtreecommitdiff
path: root/src/jvm
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-05-29 03:48:53 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2018-05-29 03:48:53 +0300
commit5c6008117bc4984719b058676182696d93bd1946 (patch)
treeaf858551bf4e46b22b198523895a5ebbb2ae7778 /src/jvm
parentb259eef71724c532b940ab10b7c2ee60db754d3d (diff)
jvm: correct names for dynamic classes
Diffstat (limited to 'src/jvm')
-rw-r--r--src/jvm/jvm.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/jvm/jvm.c b/src/jvm/jvm.c
index d6be887..b52af46 100644
--- a/src/jvm/jvm.c
+++ b/src/jvm/jvm.c
@@ -317,12 +317,27 @@ JNIEnv_DefineClass(JNIEnv* p0, const char* p1, jobject p2, const jbyte* p3, jsiz
return NULL;
}
+static char*
+cstr_replace(char *cstr, const char replace, const char with)
+{
+ assert(cstr && replace != with);
+
+ if (replace == with)
+ return cstr;
+
+ char *s = cstr;
+ while ((s = strchr(s, replace)))
+ *s = with;
+ return cstr;
+}
+
static jclass
jvm_make_class(struct jvm *jvm, const char *name)
{
assert(jvm && name);
struct jvm_object o = { .this_klass = (jclass)1, .type = JVM_OBJECT_CLASS };
jvm_string_set_cstr(&o.klass.name, name, true);
+ cstr_replace((char*)o.klass.name.data, '.', '/');
return jvm_add_object_if_not_there(jvm, &o);
}
@@ -509,20 +524,6 @@ JNIEnv_IsInstanceOf(JNIEnv* p0, jobject p1, jclass p2)
return jvm_get_object(jnienv_get_jvm(p0), p1)->this_klass == p2;
}
-static char*
-cstr_replace(char *cstr, const char replace, const char with)
-{
- assert(cstr && replace != with);
-
- if (replace == with)
- return cstr;
-
- char *s = cstr;
- while ((s = strchr(s, replace)))
- *s = with;
- return cstr;
-}
-
static void
jvm_form_symbol(struct jvm *jvm, jmethodID method_id, char *symbol, const size_t symbol_sz)
{