org.jf.dexlib2.util.SyntheticAccessorResolver Java Examples

The following examples show how to use org.jf.dexlib2.util.SyntheticAccessorResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SmaliCodeUtils.java    From atlas with Apache License 2.0 6 votes vote down vote up
/**
 * 生成解析成smali代码的选项
 *
 * @return
 */
private static BaksmaliOptions createBaksmaliOptions(ClassDef classDef) {
    BaksmaliOptions options = new BaksmaliOptions();
    options.deodex = false;
    options.parameterRegisters = false;
    options.localsDirective = true;
    options.sequentialLabels = true;
    options.debugInfo = false;
    options.codeOffsets = false;
    options.accessorComments = false;
    options.registerInfo = 0;// 128
    options.inlineResolver = null;
    options.apiLevel = DEFAULT_API_LEVEL;
    List<ClassDef> classDefs = Lists.newArrayList();
    classDefs.add(classDef);
    options.syntheticAccessorResolver = new SyntheticAccessorResolver(Opcodes.getDefault(),classDefs);
    return options;
}
 
Example #2
Source File: SmaliDiffUtils.java    From atlas with Apache License 2.0 6 votes vote down vote up
public static BaksmaliOptions getBuildOption(Iterable<? extends ClassDef> collection, int apiLevel) {
    BaksmaliOptions options = new BaksmaliOptions();

    options.deodex = false;
    options.parameterRegisters = false;
    options.localsDirective = true;
    options.sequentialLabels = true;
    options.debugInfo = true;
    options.codeOffsets = false;
    options.accessorComments = false;
    options.registerInfo = 0;// 128
    options.inlineResolver = null;
    options.apiLevel = apiLevel;
    if (!options.accessorComments) {
        options.syntheticAccessorResolver = new SyntheticAccessorResolver(Opcodes.getDefault(),collection);
    }

    return options;
}
 
Example #3
Source File: SyntheticAccessCommentMethodItem.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public SyntheticAccessCommentMethodItem(SyntheticAccessorResolver.AccessedMember accessedMember, int codeAddress) {
    super(codeAddress);
    this.accessedMember = accessedMember;
}
 
Example #4
Source File: SyntheticAccessCommentMethodItem.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public boolean writeTo(IndentingWriter writer) throws IOException {
    writer.write("# ");
    switch (accessedMember.accessedMemberType) {
        case SyntheticAccessorResolver.METHOD:
            writer.write("invokes: ");
            break;
        case SyntheticAccessorResolver.GETTER:
            writer.write("getter for: ");
            break;
        case SyntheticAccessorResolver.SETTER:
            writer.write("setter for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_INCREMENT:
            writer.write("++operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_INCREMENT:
            writer.write("operator++ for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_DECREMENT:
            writer.write("--operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_DECREMENT:
            writer.write("operator-- for: ");
            break;
        case SyntheticAccessorResolver.ADD_ASSIGNMENT:
            writer.write("+= operator for: ");
            break;
        case SyntheticAccessorResolver.SUB_ASSIGNMENT:
            writer.write("-= operator for: ");
            break;
        case SyntheticAccessorResolver.MUL_ASSIGNMENT:
            writer.write("*= operator for: ");
            break;
        case SyntheticAccessorResolver.DIV_ASSIGNMENT:
            writer.write("/= operator for: ");
            break;
        case SyntheticAccessorResolver.REM_ASSIGNMENT:
            writer.write("%= operator for: ");
            break;
        case SyntheticAccessorResolver.AND_ASSIGNMENT:
            writer.write("&= operator for: ");
            break;
        case SyntheticAccessorResolver.OR_ASSIGNMENT:
            writer.write("|= operator for: ");
            break;
        case SyntheticAccessorResolver.XOR_ASSIGNMENT:
            writer.write("^= operator for: ");
            break;
        case SyntheticAccessorResolver.SHL_ASSIGNMENT:
            writer.write("<<= operator for: ");
            break;
        case SyntheticAccessorResolver.SHR_ASSIGNMENT:
            writer.write(">>= operator for: ");
            break;
        case SyntheticAccessorResolver.USHR_ASSIGNMENT:
            writer.write(">>>= operator for: ");
            break;
        default:
            throw new ExceptionWithContext("Unknown access type: %d", accessedMember.accessedMemberType);
    }

    int referenceType;
    if (accessedMember.accessedMemberType == SyntheticAccessorResolver.METHOD) {
        referenceType = ReferenceType.METHOD;
    } else {
        referenceType = ReferenceType.FIELD;
    }
    ReferenceFormatter.writeReference(writer, referenceType, accessedMember.accessedMember);
    return true;
}
 
Example #5
Source File: SyntheticAccessCommentMethodItem.java    From atlas with Apache License 2.0 4 votes vote down vote up
public SyntheticAccessCommentMethodItem(SyntheticAccessorResolver.AccessedMember accessedMember, int codeAddress) {
    super(codeAddress);
    this.accessedMember = accessedMember;
}
 
Example #6
Source File: SyntheticAccessCommentMethodItem.java    From atlas with Apache License 2.0 4 votes vote down vote up
public boolean writeTo(IndentingWriter writer) throws IOException {
    writer.write("# ");
    switch (accessedMember.accessedMemberType) {
        case SyntheticAccessorResolver.METHOD:
            writer.write("invokes: ");
            break;
        case SyntheticAccessorResolver.GETTER:
            writer.write("getter for: ");
            break;
        case SyntheticAccessorResolver.SETTER:
            writer.write("setter for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_INCREMENT:
            writer.write("++operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_INCREMENT:
            writer.write("operator++ for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_DECREMENT:
            writer.write("--operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_DECREMENT:
            writer.write("operator-- for: ");
            break;
        case SyntheticAccessorResolver.ADD_ASSIGNMENT:
            writer.write("+= operator for: ");
            break;
        case SyntheticAccessorResolver.SUB_ASSIGNMENT:
            writer.write("-= operator for: ");
            break;
        case SyntheticAccessorResolver.MUL_ASSIGNMENT:
            writer.write("*= operator for: ");
            break;
        case SyntheticAccessorResolver.DIV_ASSIGNMENT:
            writer.write("/= operator for: ");
            break;
        case SyntheticAccessorResolver.REM_ASSIGNMENT:
            writer.write("%= operator for: ");
            break;
        case SyntheticAccessorResolver.AND_ASSIGNMENT:
            writer.write("&= operator for: ");
            break;
        case SyntheticAccessorResolver.OR_ASSIGNMENT:
            writer.write("|= operator for: ");
            break;
        case SyntheticAccessorResolver.XOR_ASSIGNMENT:
            writer.write("^= operator for: ");
            break;
        case SyntheticAccessorResolver.SHL_ASSIGNMENT:
            writer.write("<<= operator for: ");
            break;
        case SyntheticAccessorResolver.SHR_ASSIGNMENT:
            writer.write(">>= operator for: ");
            break;
        case SyntheticAccessorResolver.USHR_ASSIGNMENT:
            writer.write(">>>= operator for: ");
            break;
        default:
            throw new ExceptionWithContext("Unknown access type: %d", accessedMember.accessedMemberType);
    }

    int referenceType;
    if (accessedMember.accessedMemberType == SyntheticAccessorResolver.METHOD) {
        referenceType = ReferenceType.METHOD;
    } else {
        referenceType = ReferenceType.FIELD;
    }
    ReferenceFormatter.writeReference(writer, referenceType, accessedMember.accessedMember);
    return true;
}
 
Example #7
Source File: SyntheticAccessCommentMethodItem.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public SyntheticAccessCommentMethodItem(SyntheticAccessorResolver.AccessedMember accessedMember, int codeAddress) {
    super(codeAddress);
    this.accessedMember = accessedMember;
}
 
Example #8
Source File: SyntheticAccessCommentMethodItem.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public boolean writeTo(IndentingWriter writer) throws IOException {
    writer.write("# ");
    switch (accessedMember.accessedMemberType) {
        case SyntheticAccessorResolver.METHOD:
            writer.write("invokes: ");
            break;
        case SyntheticAccessorResolver.GETTER:
            writer.write("getter for: ");
            break;
        case SyntheticAccessorResolver.SETTER:
            writer.write("setter for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_INCREMENT:
            writer.write("++operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_INCREMENT:
            writer.write("operator++ for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_DECREMENT:
            writer.write("--operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_DECREMENT:
            writer.write("operator-- for: ");
            break;
        case SyntheticAccessorResolver.ADD_ASSIGNMENT:
            writer.write("+= operator for: ");
            break;
        case SyntheticAccessorResolver.SUB_ASSIGNMENT:
            writer.write("-= operator for: ");
            break;
        case SyntheticAccessorResolver.MUL_ASSIGNMENT:
            writer.write("*= operator for: ");
            break;
        case SyntheticAccessorResolver.DIV_ASSIGNMENT:
            writer.write("/= operator for: ");
            break;
        case SyntheticAccessorResolver.REM_ASSIGNMENT:
            writer.write("%= operator for: ");
            break;
        case SyntheticAccessorResolver.AND_ASSIGNMENT:
            writer.write("&= operator for: ");
            break;
        case SyntheticAccessorResolver.OR_ASSIGNMENT:
            writer.write("|= operator for: ");
            break;
        case SyntheticAccessorResolver.XOR_ASSIGNMENT:
            writer.write("^= operator for: ");
            break;
        case SyntheticAccessorResolver.SHL_ASSIGNMENT:
            writer.write("<<= operator for: ");
            break;
        case SyntheticAccessorResolver.SHR_ASSIGNMENT:
            writer.write(">>= operator for: ");
            break;
        case SyntheticAccessorResolver.USHR_ASSIGNMENT:
            writer.write(">>>= operator for: ");
            break;
        default:
            throw new ExceptionWithContext("Unknown access type: %d", accessedMember.accessedMemberType);
    }

    int referenceType;
    if (accessedMember.accessedMemberType == SyntheticAccessorResolver.METHOD) {
        referenceType = ReferenceType.METHOD;
    } else {
        referenceType = ReferenceType.FIELD;
    }
    ReferenceFormatter.writeReference(writer, referenceType, accessedMember.accessedMember);
    return true;
}
 
Example #9
Source File: SyntheticAccessCommentMethodItem.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public SyntheticAccessCommentMethodItem(SyntheticAccessorResolver.AccessedMember accessedMember, int codeAddress) {
    super(codeAddress);
    this.accessedMember = accessedMember;
}
 
Example #10
Source File: SyntheticAccessCommentMethodItem.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public boolean writeTo(IndentingWriter writer) throws IOException {
    writer.write("# ");
    switch (accessedMember.accessedMemberType) {
        case SyntheticAccessorResolver.METHOD:
            writer.write("invokes: ");
            break;
        case SyntheticAccessorResolver.GETTER:
            writer.write("getter for: ");
            break;
        case SyntheticAccessorResolver.SETTER:
            writer.write("setter for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_INCREMENT:
            writer.write("++operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_INCREMENT:
            writer.write("operator++ for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_DECREMENT:
            writer.write("--operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_DECREMENT:
            writer.write("operator-- for: ");
            break;
        case SyntheticAccessorResolver.ADD_ASSIGNMENT:
            writer.write("+= operator for: ");
            break;
        case SyntheticAccessorResolver.SUB_ASSIGNMENT:
            writer.write("-= operator for: ");
            break;
        case SyntheticAccessorResolver.MUL_ASSIGNMENT:
            writer.write("*= operator for: ");
            break;
        case SyntheticAccessorResolver.DIV_ASSIGNMENT:
            writer.write("/= operator for: ");
            break;
        case SyntheticAccessorResolver.REM_ASSIGNMENT:
            writer.write("%= operator for: ");
            break;
        case SyntheticAccessorResolver.AND_ASSIGNMENT:
            writer.write("&= operator for: ");
            break;
        case SyntheticAccessorResolver.OR_ASSIGNMENT:
            writer.write("|= operator for: ");
            break;
        case SyntheticAccessorResolver.XOR_ASSIGNMENT:
            writer.write("^= operator for: ");
            break;
        case SyntheticAccessorResolver.SHL_ASSIGNMENT:
            writer.write("<<= operator for: ");
            break;
        case SyntheticAccessorResolver.SHR_ASSIGNMENT:
            writer.write(">>= operator for: ");
            break;
        case SyntheticAccessorResolver.USHR_ASSIGNMENT:
            writer.write(">>>= operator for: ");
            break;
        default:
            throw new ExceptionWithContext("Unknown access type: %d", accessedMember.accessedMemberType);
    }

    int referenceType;
    if (accessedMember.accessedMemberType == SyntheticAccessorResolver.METHOD) {
        referenceType = ReferenceType.METHOD;
    } else {
        referenceType = ReferenceType.FIELD;
    }
    ReferenceFormatter.writeReference(writer, referenceType, accessedMember.accessedMember);
    return true;
}
 
Example #11
Source File: SyntheticAccessCommentMethodItem.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public SyntheticAccessCommentMethodItem(SyntheticAccessorResolver.AccessedMember accessedMember, int codeAddress) {
    super(codeAddress);
    this.accessedMember = accessedMember;
}
 
Example #12
Source File: SyntheticAccessCommentMethodItem.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public boolean writeTo(IndentingWriter writer) throws IOException {
    writer.write("# ");
    switch (accessedMember.accessedMemberType) {
        case SyntheticAccessorResolver.METHOD:
            writer.write("invokes: ");
            break;
        case SyntheticAccessorResolver.GETTER:
            writer.write("getter for: ");
            break;
        case SyntheticAccessorResolver.SETTER:
            writer.write("setter for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_INCREMENT:
            writer.write("++operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_INCREMENT:
            writer.write("operator++ for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_DECREMENT:
            writer.write("--operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_DECREMENT:
            writer.write("operator-- for: ");
            break;
        case SyntheticAccessorResolver.ADD_ASSIGNMENT:
            writer.write("+= operator for: ");
            break;
        case SyntheticAccessorResolver.SUB_ASSIGNMENT:
            writer.write("-= operator for: ");
            break;
        case SyntheticAccessorResolver.MUL_ASSIGNMENT:
            writer.write("*= operator for: ");
            break;
        case SyntheticAccessorResolver.DIV_ASSIGNMENT:
            writer.write("/= operator for: ");
            break;
        case SyntheticAccessorResolver.REM_ASSIGNMENT:
            writer.write("%= operator for: ");
            break;
        case SyntheticAccessorResolver.AND_ASSIGNMENT:
            writer.write("&= operator for: ");
            break;
        case SyntheticAccessorResolver.OR_ASSIGNMENT:
            writer.write("|= operator for: ");
            break;
        case SyntheticAccessorResolver.XOR_ASSIGNMENT:
            writer.write("^= operator for: ");
            break;
        case SyntheticAccessorResolver.SHL_ASSIGNMENT:
            writer.write("<<= operator for: ");
            break;
        case SyntheticAccessorResolver.SHR_ASSIGNMENT:
            writer.write(">>= operator for: ");
            break;
        case SyntheticAccessorResolver.USHR_ASSIGNMENT:
            writer.write(">>>= operator for: ");
            break;
        default:
            throw new ExceptionWithContext("Unknown access type: %d", accessedMember.accessedMemberType);
    }

    int referenceType;
    if (accessedMember.accessedMemberType == SyntheticAccessorResolver.METHOD) {
        referenceType = ReferenceType.METHOD;
    } else {
        referenceType = ReferenceType.FIELD;
    }
    ReferenceFormatter.writeReference(writer, referenceType, accessedMember.accessedMember);
    return true;
}