Example #1
0
func newField(class *Class, fieldInfo *cf.MemberInfo) *Field {
	field := &Field{}
	field.class = class
	field.accessFlags = fieldInfo.AccessFlags()
	field.name = fieldInfo.Name()
	field.descriptor = fieldInfo.Descriptor()
	field.signature = fieldInfo.Signature()
	field.IsLongOrDouble = (field.descriptor == "J" || field.descriptor == "D")
	if kValAttr := fieldInfo.ConstantValueAttribute(); kValAttr != nil {
		field.constValueIndex = kValAttr.ConstantValueIndex()
	}
	return field
}
Example #2
0
func (self *Method) copyAttributes(methodInfo *cf.MemberInfo) {
	if codeAttr := methodInfo.CodeAttribute(); codeAttr != nil {
		self.exceptions = methodInfo.ExceptionsAttribute()
		self.signature = methodInfo.Signature()
		self.code = codeAttr.Code()
		self.maxStack = codeAttr.MaxStack()
		self.maxLocals = codeAttr.MaxLocals()
		self.lineNumberTable = codeAttr.LineNumberTableAttribute()
		if len(codeAttr.ExceptionTable()) > 0 {
			rtCp := self.class.constantPool
			self.copyExceptionTable(codeAttr.ExceptionTable(), rtCp)
		}
	}
	self.annotationData = methodInfo.RuntimeVisibleAnnotationsAttributeData()
	self.parameterAnnotationData = methodInfo.RuntimeVisibleParameterAnnotationsAttributeData()
	self.annotationDefaultData = methodInfo.AnnotationDefaultAttributeData()
}