Documentation ¶
Index ¶
- Constants
- type Class
- func (self *Class) ConstantPool() *ConstantPool
- func (self *Class) GetMainMethod() *Method
- func (self *Class) GetPackageName() string
- func (self Class) IsAbstract() bool
- func (self *Class) IsImplements(class *Class) bool
- func (self *Class) IsInterface() bool
- func (self *Class) IsPrivate() bool
- func (self *Class) IsProtected() bool
- func (self *Class) IsPublic() bool
- func (self *Class) IsSubClassOf(class *Class) bool
- func (self *Class) IsSuper() bool
- func (self *Class) IsSuperClassOf(class *Class) bool
- func (self *Class) Name() string
- func (self *Class) NewObject() *Object
- func (self Class) StaticVars() Slots
- func (self *Class) SuperClass() *Class
- type ClassLoader
- type ClassMember
- type ClassRef
- type Constant
- type ConstantPool
- type Field
- type FieldRef
- type InterfaceMethodRef
- type MemberRef
- type Method
- func (self *Method) ArgSlotCount() uint
- func (self *Method) Class() *Class
- func (self *Method) Code() []byte
- func (self Method) Descriptor() string
- func (self Method) IsAbstract() bool
- func (self Method) IsStatic() bool
- func (self Method) MaxLocals() uint16
- func (self Method) MaxStack() uint16
- func (self Method) MethodDescriptor() string
- func (self Method) Name() string
- type MethodDescriptor
- type MethodDescriptorParser
- type MethodRef
- type Object
- type Slot
- type Slots
- func (self Slots) GetDouble(index uint) float64
- func (self Slots) GetFloat(index uint) float32
- func (self Slots) GetInt(index uint) int32
- func (self Slots) GetLong(index uint) int64
- func (self Slots) GetRef(index uint) *Object
- func (self Slots) SetDouble(index uint, val float64)
- func (self Slots) SetFloat(index uint, val float32)
- func (self Slots) SetInt(index uint, val int32)
- func (self Slots) SetLong(index uint, val int64)
- func (self Slots) SetRef(index uint, ref *Object)
- type SymRef
- type TypeDescriptor
Constants ¶
View Source
const ( // public ACC_PUBLIC = 0x0001 // private ACC_PRIVATE = 0x0002 // protected ACC_PROTECTED = 0x0004 // static ACC_STATIC = 0x0008 // final ACC_FINAL = 0x0010 // synchronized ACC_SYNCHRONIZED = 0x0020 // volatile ACC_VOLATILE = 0x0020 // super ACC_SUPER = 0x0020 // bridge ACC_BRIDGE = 0x0040 // transient ACC_TRANSIENT = 0x0040 // varargs ACC_VARARGS = 0x0080 // native ACC_NATIVE = 0x0100 // interface ACC_INTERFACE = 0x0200 // abstract ACC_ABSTRACT = 0x0400 // strict ACC_STRICT = 0x0800 // synthetic ACC_SYNTHETIC = 0x1000 // annotation ACC_ANNOTATION = 0x2000 // enum ACC_ENUM = 0x4000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Class ¶
type Class struct {
// contains filtered or unexported fields
}
func (*Class) ConstantPool ¶
func (self *Class) ConstantPool() *ConstantPool
func (*Class) GetMainMethod ¶
func (*Class) GetPackageName ¶ added in v1.7.0
func (Class) IsAbstract ¶
func (*Class) IsImplements ¶ added in v1.7.0
func (*Class) IsInterface ¶
func (*Class) IsProtected ¶
func (*Class) IsSubClassOf ¶ added in v1.7.0
判断本类是否是参数class的子类
func (*Class) IsSuperClassOf ¶ added in v1.7.0
判断本类是否是参数class的父类
func (Class) StaticVars ¶
func (*Class) SuperClass ¶ added in v1.7.0
type ClassLoader ¶
type ClassLoader struct {
// contains filtered or unexported fields
}
类加载器 类加载器依赖ClassPath来搜寻和读取class文件
func NewClassLoader ¶
func NewClassLoader(cp *classpath.Classpath, verboseFlag bool) *ClassLoader
创建一个加载器实例
func (*ClassLoader) LoadClass ¶
func (self *ClassLoader) LoadClass(name string) *Class
在classMap中根据name查询类 然后将将类数据加载到方法区中
type ClassMember ¶
type ClassMember struct {
// contains filtered or unexported fields
}
func (*ClassMember) IsPrivate ¶
func (self *ClassMember) IsPrivate() bool
func (*ClassMember) IsProtected ¶
func (self *ClassMember) IsProtected() bool
func (*ClassMember) IsPublic ¶
func (self *ClassMember) IsPublic() bool
type ConstantPool ¶
type ConstantPool struct {
// contains filtered or unexported fields
}
运行时常量池
func (*ConstantPool) GetConstant ¶
func (self *ConstantPool) GetConstant(index uint) Constant
根据索引返回常量
func (*ConstantPool) Name ¶
func (self *ConstantPool) Name() string
type Field ¶
type Field struct { ClassMember // contains filtered or unexported fields }
实例字段
func (Field) ConstValueIndex ¶
func (Field) Descriptor ¶
func (Field) IsLongOrDouble ¶
判断描述符是否属于J或者D,J -> long,D -> double 基本类型中,除了long的定义奇特外,其他都是基于首字母
type InterfaceMethodRef ¶
type InterfaceMethodRef struct { MemberRef // contains filtered or unexported fields }
接口方法的符号引用
func (InterfaceMethodRef) Descriptor ¶ added in v1.7.0
func (self InterfaceMethodRef) Descriptor() string
func (InterfaceMethodRef) Name ¶ added in v1.7.0
func (self InterfaceMethodRef) Name() string
func (*InterfaceMethodRef) ResolvedInterfaceMethod ¶ added in v1.7.0
func (self *InterfaceMethodRef) ResolvedInterfaceMethod() *Method
解析接口方法
type Method ¶
type Method struct { ClassMember // contains filtered or unexported fields }
func LookupMethodInClass ¶ added in v1.7.0
在类和父类中搜寻指定的方法
func (*Method) ArgSlotCount ¶ added in v1.7.0
func (Method) Descriptor ¶ added in v1.7.0
func (Method) IsAbstract ¶ added in v1.7.0
func (Method) MethodDescriptor ¶ added in v1.7.0
type MethodDescriptor ¶ added in v1.7.0
type MethodDescriptor struct { ParameterTypes []TypeDescriptor ReturnType TypeDescriptor }
方法的描述符 参考点有两个: 1 方法参数类型与数量 2 返回类型
虽然在虚拟机层面返回类型是可以作为方法的特征之一 但是在java中,返回类型不作为方法重载的特征之一。 原因可能是因为方法即使有返回值,调用者也可以不接收方法的返回值,这会导致编译器无法根据返回类型作为判断依据
type MethodDescriptorParser ¶ added in v1.7.0
type MethodDescriptorParser struct {
// contains filtered or unexported fields
}
type MethodRef ¶
type MethodRef struct { MemberRef // contains filtered or unexported fields }
func (MethodRef) Descriptor ¶
func (*MethodRef) ResolvedMethod ¶ added in v1.7.0
解析非接口方法
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func (*Object) IsInstanceOf ¶
type SymRef ¶
type SymRef struct {
// contains filtered or unexported fields
}
符号引用 cp,className,class是所有符号引用通用的字段 利用继承的方式来进行定制
func (*SymRef) ResolvedClass ¶
解析符号引用 如果类还没有被解析过,先解析类的符号引用 如果类已经被解析过,直接返回类的指针
type TypeDescriptor ¶ added in v1.7.0
type TypeDescriptor string
func (TypeDescriptor) IsArrayType ¶ added in v1.7.0
func (td TypeDescriptor) IsArrayType() bool
数组类型
func (TypeDescriptor) IsLongOrDouble ¶ added in v1.7.0
func (td TypeDescriptor) IsLongOrDouble() bool
long或者double类型
func (TypeDescriptor) IsObjectType ¶ added in v1.7.0
func (td TypeDescriptor) IsObjectType() bool
对象类型
func (TypeDescriptor) IsVoidType ¶ added in v1.7.0
func (td TypeDescriptor) IsVoidType() bool
void类型
Source Files ¶
Click to show internal directories.
Click to hide internal directories.