/// <summary> /// Set the access flags of the created field. /// </summary> protected virtual void SetAccessFlags(DexLib.FieldDefinition dfield, FieldDefinition field) { if (field.IsPrivate) { dfield.IsPrivate = true; } if (field.IsProtected) { dfield.IsProtected = true; } if (field.IsPublic) { dfield.IsPublic = true; } if (field.IsFinal) { dfield.IsFinal = true; } if (field.IsStatic) { dfield.IsStatic = true; } if (field.IsTransient) { dfield.IsTransient = true; } if (field.IsVolatile) { dfield.IsVolatile = true; } if (field.IsSynthetic) { dfield.IsSynthetic = true; } if (field.IsEnum) { dfield.IsEnum = true; } }
/// <summary> /// Set the value of the given dex field. /// </summary> protected virtual void SetFieldValue(DexLib.FieldDefinition dfield, FieldDefinition field) { dfield.Value = field.ConstantValue; }
/// <summary> /// Add the given method to its declaring class. /// </summary> protected virtual void AddFieldToDeclaringClass(ClassDefinition declaringClass, DexLib.FieldDefinition dmethod, DexTargetPackage targetPackage) { dmethod.Owner = declaringClass; declaringClass.Fields.Add(dmethod); }
/// <summary> /// Set the field type of the given dex field. /// </summary> protected virtual void SetFieldType(DexLib.FieldDefinition dfield, FieldDefinition field, DexTargetPackage targetPackage) { dfield.Type = field.FieldType.GetReference(XTypeUsageFlags.FieldType, targetPackage, compiler.Module); }