本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/jvm/rtda/class.Obj类的典型用法代码示例。如果您正苦于以下问题:Golang Obj类的具体用法?Golang Obj怎么用?Golang Obj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Obj类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: convertArgs
// Object[] -> []Any
func convertArgs(this, argArr *rtc.Obj, method *rtc.Method) []Any {
if method.ArgSlotCount() == 0 {
return nil
}
if method.ArgSlotCount() == 1 && !method.IsStatic() {
return []Any{this}
}
argObjs := argArr.Refs()
argTypes := method.ParsedDescriptor().ParameterTypes()
args := make([]Any, method.ArgSlotCount())
j := 0
if !method.IsStatic() {
args[0] = this
j = 1
}
for i, argType := range argTypes {
argObj := argObjs[i]
if argType.IsBaseType() {
// todo
unboxed := box.Unbox(argObj, argType.Descriptor())
args[i+j] = unboxed
if argType.IsLongOrDouble() {
j++
}
} else {
args[i+j] = argObj
}
}
return args
}
示例2: _getGoField
func _getGoField(fieldObj *rtc.Obj) *rtc.Field {
extra := fieldObj.Extra()
if extra != nil {
return extra.(*rtc.Field)
}
root := fieldObj.GetFieldValue("root", "Ljava/lang/reflect/Field;").(*rtc.Obj)
return root.Extra().(*rtc.Field)
}
示例3: checkArrayCopy
func checkArrayCopy(src, dest *rtc.Obj) bool {
srcClass := src.Class()
destClass := dest.Class()
if !srcClass.IsArray() || !destClass.IsArray() {
return false
}
if srcClass.IsPrimitiveArray() || destClass.IsPrimitiveArray() {
return srcClass == destClass
}
return true
}
示例4: _casObj
func _casObj(obj *rtc.Obj, fields []Any, offset int64, expected, newVal *rtc.Obj) bool {
// todo
obj.LockState()
defer obj.UnlockState()
current := _getObj(fields, offset)
if current == expected {
fields[offset] = newVal
return true
} else {
return false
}
}
示例5: HandleUncaughtException
func (self *Thread) HandleUncaughtException(ex *rtc.Obj) {
self.stack.clear()
sysClass := rtc.BootLoader().LoadClass("java/lang/System")
sysErr := sysClass.GetStaticValue("out", "Ljava/io/PrintStream;").(*rtc.Obj)
printStackTrace := ex.Class().GetInstanceMethod("printStackTrace", "(Ljava/io/PrintStream;)V")
// call ex.printStackTrace(System.err)
newFrame := self.NewFrame(printStackTrace)
vars := newFrame.localVars
vars.SetRef(0, ex)
vars.SetRef(1, sysErr)
self.PushFrame(newFrame)
//
// printString := sysErr.Class().GetInstanceMethod("print", "(Ljava/lang/String;)V")
// newFrame = self.NewFrame(printString)
// vars = newFrame.localVars
// vars.SetRef(0, sysErr)
// vars.SetRef(1, JString("Exception in thread \"main\" ", newFrame))
// self.PushFrame(newFrame)
}
示例6: _extraThread
func _extraThread(threadObj *rtc.Obj) *rtda.Thread {
threadObj.RLockState()
defer threadObj.RUnlockState()
extra := threadObj.Extra()
if extra == nil {
return nil
} else {
return extra.(*rtda.Thread)
}
}
示例7: _getGoMethod
func _getGoMethod(methodObj *rtc.Obj, isConstructor bool) *rtc.Method {
extra := methodObj.Extra()
if extra != nil {
return extra.(*rtc.Method)
}
if isConstructor {
root := methodObj.GetFieldValue("root", "Ljava/lang/reflect/Constructor;").(*rtc.Obj)
return root.Extra().(*rtc.Method)
} else {
root := methodObj.GetFieldValue("root", "Ljava/lang/reflect/Method;").(*rtc.Obj)
return root.Extra().(*rtc.Method)
}
}
示例8: isAppClassLoader
// todo
func isAppClassLoader(loader *rtc.Obj) bool {
return loader.Class().Name() == "sun/misc/Launcher$AppClassLoader"
}
示例9: Unbox
func Unbox(obj *rtc.Obj, primitiveDescriptor string) Any {
return obj.GetFieldValue("value", primitiveDescriptor)
}
示例10: _getPath
func _getPath(fileObj *rtc.Obj) string {
pathStr := fileObj.GetFieldValue("path", "Ljava/lang/String;").(*rtc.Obj)
return rtda.GoString(pathStr)
}
示例11: GoString
// java.lang.String -> go string
func GoString(jStr *rtc.Obj) string {
charArr := jStr.GetFieldValue("value", "[C").(*rtc.Obj)
return _utf16ToString(charArr.Chars())
}