public static JavaField CreateFeld(JavaClass javaclass, MemberInfo memberfileInfo, Dictionary <int, ConstantInfo> staticCP) { var result = new JavaField(); result.Class = javaclass; result.AccessFlags = memberfileInfo.AccessFlag; result.Name = ((UTF8_CP)staticCP[memberfileInfo.Name_Index]).DataString; result.Descriptor = ((UTF8_CP)staticCP[memberfileInfo.Desc_index]).DataString; if (result.IsStatic() && result.IsFinal()) { var finalfieldConstantVal = memberfileInfo.Attribute_Info.FirstOrDefault(x => x.GetType() == typeof(ConstanValueAttr)) as ConstanValueAttr; if (finalfieldConstantVal != null) { result.ConstantValue = finalfieldConstantVal.Constantvalue_Index; } else { result.ConstantValue = 0; } } return(result); }
private void Convert() { AccessFlag = this.classFile.AccessFlags; SuperClassName = this.classFile.SuperclassName; InterfaceNames = this.classFile.InterfaceNames; var name = this.classFile.ThisClassName; this.ThisClassName = name; var hasPack = name.LastIndexOf("/"); if (hasPack != -1) { this.ThisPackageName = name.Substring(0, hasPack); } foreach (var field in this.classFile.FieldInfo) { Fields.Add(JavaField.CreateFeld(this, field, this.classFile.ConstantPools)); } foreach (var method in this.classFile.MethodInfo) { Methods.Add(JavaMethod.CreateMethod(this, method, this.classFile.ConstantPools)); } RTCP = new RuntimeConstantPools(this.classFile.ConstantPools, ClassLoader, this); }