예제 #1
0
파일: clazz.py 프로젝트: 4toblerone/pyjvm
def java_lang_Class_getPrimitiveClass__Ljava_lang_String__Ljava_lang_Class_(frame, args):
    ref = args[0]
    assert type(ref) is tuple and ref[0] == "ref"
    instance = frame.vm.heap[ref[1]]
    assert instance.java_class.this_name == "java/lang/String"
    value_ref = instance.fields["value"]
    value = arr_to_string(frame.vm.heap[value_ref[1]].values)
    jc = frame.vm.get_class(value)
    frame.stack.append(jc.heap_ref)
예제 #2
0
파일: string.py 프로젝트: MatevzFa/pyjvm
def java_lang_String_intern___Ljava_lang_String_(frame, args):
    ref = args[0]
    assert type(ref) is tuple and ref[0] == "ref"
    o = frame.vm.heap[ref[1]]
    ref = o.fields["value"]
    o = frame.vm.heap[ref[1]]  # this is JArray
    s = arr_to_string(o.values)
    ref = frame.vm.make_heap_string(s)
    frame.stack.append(ref)
예제 #3
0
파일: clazz.py 프로젝트: MatevzFa/pyjvm
def java_lang_Class_getPrimitiveClass__Ljava_lang_String__Ljava_lang_Class_(
        frame, args):
    ref = args[0]
    assert type(ref) is tuple and ref[0] == "ref"
    instance = frame.vm.heap[ref[1]]
    assert instance.java_class.this_name == "java/lang/String"
    value_ref = instance.fields["value"]
    value = arr_to_string(frame.vm.heap[value_ref[1]].values)
    jc = frame.vm.get_class(value)
    frame.stack.append(jc.heap_ref)