Search in sources :

Example 1 with AccessFlags

use of org.jf.dexlib2.AccessFlags in project atlas by alibaba.

the class ClassDefinition method writeAccessFlags.

private void writeAccessFlags(IndentingWriter writer) throws IOException {
    for (AccessFlags accessFlag : AccessFlags.getAccessFlagsForClass(classDef.getAccessFlags())) {
        writer.write(accessFlag.toString());
        writer.write(' ');
    }
}
Also used : AccessFlags(org.jf.dexlib2.AccessFlags)

Example 2 with AccessFlags

use of org.jf.dexlib2.AccessFlags in project atlas by alibaba.

the class FieldDefinition method writeTo.

public static void writeTo(baksmaliOptions options, IndentingWriter writer, Field field, boolean setInStaticConstructor) throws IOException {
    EncodedValue initialValue = field.getInitialValue();
    int accessFlags = field.getAccessFlags();
    if (setInStaticConstructor && AccessFlags.STATIC.isSet(accessFlags) && AccessFlags.FINAL.isSet(accessFlags) && initialValue != null) {
        if (!EncodedValueUtils.isDefaultValue(initialValue)) {
            writer.write("# The value of this static final field might be set in the static constructor\n");
        } else {
            // don't write out the default initial value for static final fields that get set in the static
            // constructor
            initialValue = null;
        }
    }
    writer.write(".field ");
    writeAccessFlags(writer, field.getAccessFlags());
    writer.write(field.getName());
    writer.write(':');
    String clazz = TypeGenUtil.newType(field.getType());
    writer.write(clazz);
    if (initialValue != null) {
        writer.write(" = ");
        String containingClass = null;
        if (options.useImplicitReferences) {
            containingClass = field.getDefiningClass();
        }
        EncodedValueAdaptor.writeTo(writer, initialValue, containingClass);
    }
    writer.write('\n');
    Collection<? extends Annotation> annotations = field.getAnnotations();
    if (annotations.size() > 0) {
        writer.indent(4);
        String containingClass = null;
        if (options.useImplicitReferences) {
            containingClass = field.getDefiningClass();
        }
        AnnotationFormatter.writeTo(writer, annotations, containingClass);
        writer.deindent(4);
        writer.write(".end field\n");
    }
}
Also used : EncodedValue(org.jf.dexlib2.iface.value.EncodedValue)

Example 3 with AccessFlags

use of org.jf.dexlib2.AccessFlags in project atlas by alibaba.

the class FieldDefinition method writeAccessFlags.

private static void writeAccessFlags(IndentingWriter writer, int accessFlags) throws IOException {
    for (AccessFlags accessFlag : AccessFlags.getAccessFlagsForField(accessFlags)) {
        writer.write(accessFlag.toString());
        writer.write(' ');
    }
}
Also used : AccessFlags(org.jf.dexlib2.AccessFlags)

Example 4 with AccessFlags

use of org.jf.dexlib2.AccessFlags in project smali by JesusFreke.

the class SmaliModifierList method getAccessFlags.

public int getAccessFlags() {
    SmaliModifierListStub stub = getStub();
    if (stub != null) {
        return stub.getAccessFlags();
    }
    int flags = 0;
    for (PsiElement accessSpec : findChildrenByType(SmaliTokens.ACCESS_SPEC)) {
        AccessFlags flag = AccessFlags.getAccessFlag(accessSpec.getText());
        if (flag != null) {
            flags |= flag.getValue();
        }
    }
    return flags;
}
Also used : SmaliModifierListStub(org.jf.smalidea.psi.stub.SmaliModifierListStub) StubBasedPsiElement(com.intellij.psi.StubBasedPsiElement) PsiElement(com.intellij.psi.PsiElement) AccessFlags(org.jf.dexlib2.AccessFlags)

Example 5 with AccessFlags

use of org.jf.dexlib2.AccessFlags in project smali by JesusFreke.

the class FieldDefinition method writeAccessFlags.

private static void writeAccessFlags(IndentingWriter writer, int accessFlags) throws IOException {
    for (AccessFlags accessFlag : AccessFlags.getAccessFlagsForField(accessFlags)) {
        writer.write(accessFlag.toString());
        writer.write(' ');
    }
}
Also used : AccessFlags(org.jf.dexlib2.AccessFlags)

Aggregations

AccessFlags (org.jf.dexlib2.AccessFlags)7 Method (org.jf.dexlib2.iface.Method)4 InnerClassTag (soot.tagkit.InnerClassTag)4 ParamNamesTag (soot.tagkit.ParamNamesTag)4 Tag (soot.tagkit.Tag)4 ArrayList (java.util.ArrayList)3 Annotation (org.jf.dexlib2.iface.Annotation)3 EncodedValue (org.jf.dexlib2.iface.value.EncodedValue)3 ImmutableMethod (org.jf.dexlib2.immutable.ImmutableMethod)3 SootMethod (soot.SootMethod)3 Nonnull (javax.annotation.Nonnull)2 AnnotationElement (org.jf.dexlib2.iface.AnnotationElement)2 ClassDef (org.jf.dexlib2.iface.ClassDef)2 Field (org.jf.dexlib2.iface.Field)2 ImmutableAnnotation (org.jf.dexlib2.immutable.ImmutableAnnotation)2 ImmutableMethodParameter (org.jf.dexlib2.immutable.ImmutableMethodParameter)2 ImmutableEncodedValue (org.jf.dexlib2.immutable.value.ImmutableEncodedValue)2 ImmutableIntEncodedValue (org.jf.dexlib2.immutable.value.ImmutableIntEncodedValue)2 SootClass (soot.SootClass)2 SootField (soot.SootField)2