Java Code Examples for org.jf.dexlib2.dexbacked.DexBackedMethod#getImplementation()

The following examples show how to use org.jf.dexlib2.dexbacked.DexBackedMethod#getImplementation() . 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: ComplexityAnalyzer.java    From apkfile with Apache License 2.0 6 votes vote down vote up
public void analyze() {
    for (DexFile dexFile : dexFiles) {
        for (DexMethod dexMethod : dexFile.getMethodDescriptorToMethod().values()) {
            if (dexMethod.getCyclomaticComplexity() >= 0) {
                continue;
            }

            DexBackedMethod method = dexMethod.getMethod();
            DexBackedMethodImplementation implementation = method.getImplementation();
            if (implementation != null) {
                int complexity = calculateComplexity(implementation, dexFiles, new HashSet<>());
                dexMethod.setCyclomaticComplexity(complexity);
            }
        }

    }

}
 
Example 2
Source File: DexMethod.java    From apkfile with Apache License 2.0 5 votes vote down vote up
DexMethod(DexBackedMethod method, boolean shortMethodSignatures) {
    this.method = method;
    this.shortMethodSignatures = shortMethodSignatures;

    size = method.getSize();
    accessFlags = method.getAccessFlags();
    annotationCount = method.getAnnotations().size();
    frameworkApiCounts = new TObjectIntHashMap<>();
    frameworkFieldReferenceCounts = new TObjectIntHashMap<>();
    opCounts = new TIntIntHashMap();
    stringReferenceCounts = new TObjectIntHashMap<>();
    if (method.getImplementation() != null) {
        analyze(method.getImplementation());
    }
}