本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/rtda/heap.Object.Class方法的典型用法代码示例。如果您正苦于以下问题:Golang Object.Class方法的具体用法?Golang Object.Class怎么用?Golang Object.Class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zxh0/jvm/go/jvmgo/rtda/heap.Object
的用法示例。
在下文中一共展示了Object.Class方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createStackTraceElements
func createStackTraceElements(tObj *heap.Object, frame *rtda.Frame) []*StackTraceElement {
thread := frame.Thread()
depth := thread.StackDepth()
// skip unrelated frames
i := uint(1)
for k := tObj.Class(); k != nil; k = k.SuperClass() {
i++
}
if thread.TopFrameN(i).Method().Name() == "<athrow>" {
i++
}
stes := make([]*StackTraceElement, 0, depth)
for ; i < depth; i++ {
frameN := thread.TopFrameN(i)
methodN := frameN.Method()
classN := methodN.Class()
if classN.Name() != "~shim" { // skip shim frame
lineNumber := methodN.GetLineNumber(frameN.NextPC() - 1)
ste := &StackTraceElement{
declaringClass: classN.NameJlsFormat(),
methodName: methodN.Name(),
fileName: classN.SourceFile(),
lineNumber: lineNumber,
}
stes = append(stes, ste)
}
}
return stes
}
示例2: checkArrayCopy
func checkArrayCopy(src, dest *heap.Object) bool {
srcClass := src.Class()
destClass := dest.Class()
if !srcClass.IsArray() || !destClass.IsArray() {
return false
}
if srcClass.IsPrimitiveArray() || destClass.IsPrimitiveArray() {
return srcClass == destClass
}
return true
}
示例3: HandleUncaughtException
func (self *Thread) HandleUncaughtException(ex *heap.Object) {
self.stack.clear()
sysClass := heap.BootLoader().LoadClass("java/lang/System")
sysErr := sysClass.GetStaticValue("out", "Ljava/io/PrintStream;").(*heap.Object)
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)
}
示例4: isAppClassLoader
// todo
func isAppClassLoader(loader *heap.Object) bool {
return loader.Class().Name() == "sun/misc/Launcher$AppClassLoader"
}