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(' ');
}
}
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");
}
}
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(' ');
}
}
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;
}
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(' ');
}
}
Aggregations