Java Code Examples for org.jf.dexlib2.iface.Method#getAccessFlags()

The following examples show how to use org.jf.dexlib2.iface.Method#getAccessFlags() . 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: MetaObjectDex.java    From android-classyshark with Apache License 2.0 6 votes vote down vote up
@Override
public ConstructorInfo[] getDeclaredConstructors() {
    Iterable<? extends Method> implConstructors = classDef.getMethods();
    List<ConstructorInfo> result = new ArrayList<>();

    for (Method constructor : implConstructors) {
        if (isConstructor(constructor)) {
            ConstructorInfo ci = new ConstructorInfo();
            ci.parameterTypes = convertParameters(constructor.getParameters());
            ci.annotations = convertAnnotations(constructor.getAnnotations());
            ci.modifiers = constructor.getAccessFlags();

            result.add(ci);
        }
    }

    ConstructorInfo[] array = new ConstructorInfo[result.size()];
    return result.toArray(array);
}
 
Example 2
Source File: MetaObjectDex.java    From android-classyshark with Apache License 2.0 6 votes vote down vote up
@Override
public MethodInfo[] getDeclaredMethods() {
    Iterable<? extends Method> implMethods = classDef.getMethods();
    List<MethodInfo> result = new ArrayList<>();

    for (Method method : implMethods) {
        if (!isConstructor(method)) {
            MethodInfo mi = new MethodInfo();
            mi.parameterTypes = convertParameters(method.getParameters());
            mi.annotations = convertAnnotations(method.getAnnotations());
            mi.modifiers = method.getAccessFlags();
            mi.name = method.getName();
            mi.exceptionTypes = new ExceptionInfo[0];
            mi.returnType = DexlibAdapter.getTypeName(method.getReturnType());

            result.add(mi);
        }
    }

    MethodInfo[] array = new MethodInfo[result.size()];
    return result.toArray(array);
}
 
Example 3
Source File: ImmutableMethod.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableMethod of(Method method) {
    if (method instanceof ImmutableMethod) {
        return (ImmutableMethod)method;
    }
    return new ImmutableMethod(
            method.getDefiningClass(),
            method.getName(),
            method.getParameters(),
            method.getReturnType(),
            method.getAccessFlags(),
            method.getAnnotations(),
            method.getImplementation());
}
 
Example 4
Source File: ImmutableMethod.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableMethod of(Method method) {
    if (method instanceof ImmutableMethod) {
        return (ImmutableMethod)method;
    }
    return new ImmutableMethod(
            method.getDefiningClass(),
            method.getName(),
            method.getParameters(),
            method.getReturnType(),
            method.getAccessFlags(),
            method.getAnnotations(),
            method.getImplementation());
}
 
Example 5
Source File: ImmutableMethod.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public static ImmutableMethod of(Method method) {
    if (method instanceof ImmutableMethod) {
        return (ImmutableMethod)method;
    }
    return new ImmutableMethod(
            method.getDefiningClass(),
            method.getName(),
            method.getParameters(),
            method.getReturnType(),
            method.getAccessFlags(),
            method.getAnnotations(),
            method.getImplementation());
}
 
Example 6
Source File: ImmutableMethod.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableMethod of(Method method) {
    if (method instanceof ImmutableMethod) {
        return (ImmutableMethod)method;
    }
    return new ImmutableMethod(
            method.getDefiningClass(),
            method.getName(),
            method.getParameters(),
            method.getReturnType(),
            method.getAccessFlags(),
            method.getAnnotations(),
            method.getImplementation());
}
 
Example 7
Source File: MethodUtil.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static boolean isDirect(@Nonnull Method method) {
    return (method.getAccessFlags() & directMask) != 0;
}
 
Example 8
Source File: MethodReIClassDef.java    From atlas with Apache License 2.0 4 votes vote down vote up
@Override
public Method reMethod(Method method) {
    String newType = null;
    boolean isBasic = false;
    boolean isInit = false;
    boolean changeOpcode = false;
    String methodName = method.getName();
    String returnType = method.getReturnType();
    MethodImplementation methodImplementation = method.getImplementation();
    List<? extends MethodParameter> paramters = method.getParameters();
    if (methodName.equals("<init>") || methodName.equals("<cinit>")) {
        isInit = true;
    }


    if (basicType.containsKey(returnType)) {
        newType = returnType;
        isBasic = true;
    } else {
        newType = classProcessor.classProcess(DefineUtils.getDalvikClassName(returnType)).className;
    }

    String[] argsOringn = new String[paramters.size()];
    String[] args = new String[paramters.size()];
    for (int i = 0; i < paramters.size(); i++) {
        //型参数不混淆
        if (basicType.containsKey(paramters.get(i).getType())) {
            argsOringn[i] = basicType.get(paramters.get(i).getType());
            args[i] = argsOringn[i];
            continue;
        }
        argsOringn[i] = DefineUtils.getDalvikClassName(paramters.get(i).getType());
        args[i] = classProcessor.classProcess(DefineUtils.getDalvikClassName(paramters.get(i).getType())).className;
    }
    String type = method.getReturnType();
    
    return new ImmutableMethod(reType,
            classProcessor.methodProcess(isInit ? methodName :
                    DefineUtils.getDalvikClassName(method.getDefiningClass()), methodName, isBasic ? basicType.get(returnType) : DefineUtils.getDalvikClassName(returnType), StringUtils.join(argsOringn, ",")).methodName,
            reParameters(paramters),
            isBasic ? newType:
                    DefineUtils.getDefineClassName(newType,type.startsWith("[")),
                method.getAccessFlags(),
            getAnnotation(method.getAnnotations()),
            reMethodImpl(methodImplementation));

}
 
Example 9
Source File: MethodUtil.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public static boolean isDirect(@Nonnull Method method) {
    return (method.getAccessFlags() & directMask) != 0;
}
 
Example 10
Source File: MethodUtil.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public static boolean isDirect(@Nonnull Method method) {
    return (method.getAccessFlags() & directMask) != 0;
}
 
Example 11
Source File: MethodUtil.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static boolean isDirect(@Nonnull Method method) {
    return (method.getAccessFlags() & directMask) != 0;
}