Ejemplo n.º 1
0
func createArgs() *heap.Object {
	jArgs := make([]*heap.Object, len(_args))
	for i, arg := range _args {
		jArgs[i] = rtda.JString(arg)
	}

	return heap.NewRefArray2(_classLoader.JLStringClass(), jArgs)
}
Ejemplo n.º 2
0
// private native Class<?>[] getInterfaces0();
// ()[Ljava/lang/Class;
func getInterfaces0(frame *rtda.Frame) {
	class := _popClass(frame)
	interfaces := class.Interfaces()
	interfaceObjs := make([]*heap.Object, len(interfaces))
	for i, iface := range interfaces {
		interfaceObjs[i] = iface.JClass()
	}

	jlClassClass := heap.BootLoader().JLClassClass()
	interfaceArr := heap.NewRefArray2(jlClassClass, interfaceObjs)

	stack := frame.OperandStack()
	stack.PushRef(interfaceArr)
}
Ejemplo n.º 3
0
func _createEnclosintMethodInfo(classLoader *heap.ClassLoader, emInfo *heap.EnclosingMethod) *heap.Object {
	if emInfo == nil {
		return nil
	}

	enclosingClass := classLoader.LoadClass(emInfo.ClassName())
	enclosingClassObj := enclosingClass.JClass()
	var methodNameObj, methodDescriptorObj *heap.Object
	if emInfo.MethodName() != "" {
		methodNameObj = rtda.JString(emInfo.MethodName())
		methodDescriptorObj = rtda.JString(emInfo.MethodDescriptor())
	} else {
		methodNameObj, methodDescriptorObj = nil, nil
	}

	objs := []*heap.Object{enclosingClassObj, methodNameObj, methodDescriptorObj}
	return heap.NewRefArray2(classLoader.JLObjectClass(), objs) // Object[]
}