本文整理汇总了Java中org.jf.dexlib2.AccessFlags类的典型用法代码示例。如果您正苦于以下问题:Java AccessFlags类的具体用法?Java AccessFlags怎么用?Java AccessFlags使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessFlags类属于org.jf.dexlib2包,在下文中一共展示了AccessFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzeExecuteInline
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private void analyzeExecuteInline(@Nonnull AnalyzedInstruction analyzedInstruction) {
if (inlineResolver == null) {
throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing");
}
Instruction35mi instruction = (Instruction35mi)analyzedInstruction.instruction;
Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction);
Opcode deodexedOpcode;
int acccessFlags = resolvedMethod.getAccessFlags();
if (AccessFlags.STATIC.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_STATIC;
} else if (AccessFlags.PRIVATE.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_DIRECT;
} else {
deodexedOpcode = Opcode.INVOKE_VIRTUAL;
}
Instruction35c deodexedInstruction = new ImmutableInstruction35c(deodexedOpcode, instruction.getRegisterCount(),
instruction.getRegisterC(), instruction.getRegisterD(), instruction.getRegisterE(),
instruction.getRegisterF(), instruction.getRegisterG(), resolvedMethod);
analyzedInstruction.setDeodexedInstruction(deodexedInstruction);
analyzeInstruction(analyzedInstruction);
}
示例2: analyzeExecuteInlineRange
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private void analyzeExecuteInlineRange(@Nonnull AnalyzedInstruction analyzedInstruction) {
if (inlineResolver == null) {
throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing");
}
Instruction3rmi instruction = (Instruction3rmi)analyzedInstruction.instruction;
Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction);
Opcode deodexedOpcode;
int acccessFlags = resolvedMethod.getAccessFlags();
if (AccessFlags.STATIC.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_STATIC_RANGE;
} else if (AccessFlags.PRIVATE.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_DIRECT_RANGE;
} else {
deodexedOpcode = Opcode.INVOKE_VIRTUAL_RANGE;
}
Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(deodexedOpcode, instruction.getStartRegister(),
instruction.getRegisterCount(), resolvedMethod);
analyzedInstruction.setDeodexedInstruction(deodexedInstruction);
analyzeInstruction(analyzedInstruction);
}
示例3: canAccess
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
public static boolean canAccess( TypeProto type, Method virtualMethod, boolean checkPackagePrivate,
boolean checkProtected, boolean checkClass) {
if (checkPackagePrivate && MethodUtil.isPackagePrivate(virtualMethod)) {
String otherPackage = TypeUtils.getPackage(virtualMethod.getDefiningClass());
String thisPackage = TypeUtils.getPackage(type.getType());
if (!otherPackage.equals(thisPackage)) {
return false;
}
}
if (checkProtected && (virtualMethod.getAccessFlags() & AccessFlags.PROTECTED.getValue()) != 0) {
if (!TypeProtoUtils.extendsFrom(type, virtualMethod.getDefiningClass())) {
return false;
}
}
if (checkClass) {
ClassPath classPath = type.getClassPath();
ClassDef methodClassDef = classPath.getClassDef(virtualMethod.getDefiningClass());
if (!TypeUtils.canAccessClass(type.getType(), methodClassDef)) {
return false;
}
}
return true;
}
示例4: analyzeExecuteInline
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private void analyzeExecuteInline( AnalyzedInstruction analyzedInstruction) {
if (inlineResolver == null) {
throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing");
}
Instruction35mi instruction = (Instruction35mi)analyzedInstruction.instruction;
Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction);
Opcode deodexedOpcode;
int acccessFlags = resolvedMethod.getAccessFlags();
if (AccessFlags.STATIC.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_STATIC;
} else if (AccessFlags.PRIVATE.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_DIRECT;
} else {
deodexedOpcode = Opcode.INVOKE_VIRTUAL;
}
Instruction35c deodexedInstruction = new ImmutableInstruction35c(deodexedOpcode, instruction.getRegisterCount(),
instruction.getRegisterC(), instruction.getRegisterD(), instruction.getRegisterE(),
instruction.getRegisterF(), instruction.getRegisterG(), resolvedMethod);
analyzedInstruction.setDeodexedInstruction(deodexedInstruction);
analyzeInstruction(analyzedInstruction);
}
示例5: analyzeExecuteInlineRange
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private void analyzeExecuteInlineRange( AnalyzedInstruction analyzedInstruction) {
if (inlineResolver == null) {
throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing");
}
Instruction3rmi instruction = (Instruction3rmi)analyzedInstruction.instruction;
Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction);
Opcode deodexedOpcode;
int acccessFlags = resolvedMethod.getAccessFlags();
if (AccessFlags.STATIC.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_STATIC_RANGE;
} else if (AccessFlags.PRIVATE.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_DIRECT_RANGE;
} else {
deodexedOpcode = Opcode.INVOKE_VIRTUAL_RANGE;
}
Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(deodexedOpcode, instruction.getStartRegister(),
instruction.getRegisterCount(), resolvedMethod);
analyzedInstruction.setDeodexedInstruction(deodexedInstruction);
analyzeInstruction(analyzedInstruction);
}
示例6: canAccess
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
public static boolean canAccess(@Nonnull TypeProto type, @Nonnull Method virtualMethod, boolean checkPackagePrivate,
boolean checkProtected, boolean checkClass) {
if (checkPackagePrivate && MethodUtil.isPackagePrivate(virtualMethod)) {
String otherPackage = TypeUtils.getPackage(virtualMethod.getDefiningClass());
String thisPackage = TypeUtils.getPackage(type.getType());
if (!otherPackage.equals(thisPackage)) {
return false;
}
}
if (checkProtected && (virtualMethod.getAccessFlags() & AccessFlags.PROTECTED.getValue()) != 0) {
if (!TypeProtoUtils.extendsFrom(type, virtualMethod.getDefiningClass())) {
return false;
}
}
if (checkClass) {
ClassPath classPath = type.getClassPath();
ClassDef methodClassDef = classPath.getClassDef(virtualMethod.getDefiningClass());
if (!TypeUtils.canAccessClass(type.getType(), methodClassDef)) {
return false;
}
}
return true;
}
示例7: analyzeExecuteInline
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private void analyzeExecuteInline(@Nonnull AnalyzedInstruction analyzedInstruction) {
if (inlineResolver == null) {
throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing");
}
Instruction35mi instruction = (Instruction35mi) analyzedInstruction.instruction;
Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction);
Opcode deodexedOpcode;
int acccessFlags = resolvedMethod.getAccessFlags();
if (AccessFlags.STATIC.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_STATIC;
} else if (AccessFlags.PRIVATE.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_DIRECT;
} else {
deodexedOpcode = Opcode.INVOKE_VIRTUAL;
}
Instruction35c deodexedInstruction = new ImmutableInstruction35c(deodexedOpcode, instruction.getRegisterCount(),
instruction.getRegisterC(), instruction.getRegisterD(), instruction.getRegisterE(),
instruction.getRegisterF(), instruction.getRegisterG(), resolvedMethod);
analyzedInstruction.setDeodexedInstruction(deodexedInstruction);
analyzeInstruction(analyzedInstruction);
}
示例8: analyzeExecuteInlineRange
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private void analyzeExecuteInlineRange(@Nonnull AnalyzedInstruction analyzedInstruction) {
if (inlineResolver == null) {
throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing");
}
Instruction3rmi instruction = (Instruction3rmi) analyzedInstruction.instruction;
Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction);
Opcode deodexedOpcode;
int acccessFlags = resolvedMethod.getAccessFlags();
if (AccessFlags.STATIC.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_STATIC_RANGE;
} else if (AccessFlags.PRIVATE.isSet(acccessFlags)) {
deodexedOpcode = Opcode.INVOKE_DIRECT_RANGE;
} else {
deodexedOpcode = Opcode.INVOKE_VIRTUAL_RANGE;
}
Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(deodexedOpcode, instruction.getStartRegister(),
instruction.getRegisterCount(), resolvedMethod);
analyzedInstruction.setDeodexedInstruction(deodexedInstruction);
analyzeInstruction(analyzedInstruction);
}
示例9: getAnnotatedMethods
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private Set<MethodAnnotationPair> getAnnotatedMethods(Set<ClassDef> classes) {
Set<MethodAnnotationPair> result = new HashSet<>();
for (ClassDef classDef : classes)
for (Method method : classDef.getMethods())
for (Annotation a : method.getAnnotations()) {
if (a.getType().equals(METHOD_PERMISSION_ANNOTATION)) {
final int flags = method.getAccessFlags();
boolean isPublic = AccessFlags.PUBLIC.isSet(flags);
boolean isStatic = AccessFlags.STATIC.isSet(flags);
if (isPublic && isStatic)
result.add(new MethodAnnotationPair(method, a));
else
PrintWarning("ignoring method " + method.getDefiningClass() + "." + method.getName() + " " +
"because is not static and public");
break;
}
}
return result;
}
示例10: translateAccessFlags
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private static int translateAccessFlags(int accessFlags) {
int f = 0;
f |= (AccessFlags.ABSTRACT.isSet(accessFlags) ? Modifier.ABSTRACT : 0);
// f |= (AccessFlags.ANNOTATION.isSet(accessFlags) ? Modifier.ANNOTATION : 0);
// f |= (AccessFlags.BRIDGE.isSet(accessFlags) ? Modifier.BRIDGE : 0);
// f |= (AccessFlags.CONSTRUCTOR.isSet(accessFlags) ? Modifier.CONSTRUCTOR : 0);
// f |= (AccessFlags.DECLARED_SYNCHRONIZED.isSet(accessFlags) ? Modifier.DECLARED_SYNCHRONIZED : 0);
// f |= (AccessFlags.ENUM.isSet(accessFlags) ? Modifier.ENUM : 0);
f |= (AccessFlags.FINAL.isSet(accessFlags) ? Modifier.FINAL : 0);
f |= (AccessFlags.INTERFACE.isSet(accessFlags) ? Modifier.INTERFACE : 0);
f |= (AccessFlags.NATIVE.isSet(accessFlags) ? Modifier.NATIVE : 0);
f |= (AccessFlags.PRIVATE.isSet(accessFlags) ? Modifier.PRIVATE : 0);
f |= (AccessFlags.PROTECTED.isSet(accessFlags) ? Modifier.PROTECTED : 0);
f |= (AccessFlags.PUBLIC.isSet(accessFlags) ? Modifier.PUBLIC : 0);
f |= (AccessFlags.STATIC.isSet(accessFlags) ? Modifier.STATIC : 0);
f |= (AccessFlags.STRICTFP.isSet(accessFlags) ? Modifier.STRICT : 0);
f |= (AccessFlags.SYNCHRONIZED.isSet(accessFlags) ? Modifier.SYNCHRONIZED : 0);
// f |= (AccessFlags.SYNTHETIC.isSet(accessFlags) ? Modifier.SYNTHETIC : 0);
f |= (AccessFlags.TRANSIENT.isSet(accessFlags) ? Modifier.TRANSIENT : 0);
// f |= (AccessFlags.VARARGS.isSet(accessFlags) ? Modifier.VARARGS : 0);
f |= (AccessFlags.VOLATILE.isSet(accessFlags) ? Modifier.VOLATILE : 0);
return f;
}
示例11: addField
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
public static DexFile addField(DexFile dexFile, final String className, final Field field) {
DexRewriter rewriter = new DexRewriter(new RewriterModule() {
@Nonnull
@Override
public Rewriter<ClassDef> getClassDefRewriter(@Nonnull Rewriters rewriters) {
return new ClassDefRewriter(rewriters) {
@Nonnull
@Override
public ClassDef rewrite(@Nonnull ClassDef classDef) {
if (classDef.getType().equals(className)) {
return new RewrittenClassDef(classDef) {
@Nonnull
@Override
public Iterable<? extends Field> getInstanceFields() {
if ((field.getAccessFlags() & AccessFlags.STATIC.getValue()) == 0) {
return Iterables.concat(super.getInstanceFields(), ImmutableList.of(field));
}
return super.getInstanceFields();
}
@Nonnull
@Override
public Iterable<? extends Field> getStaticFields() {
if ((field.getAccessFlags() & AccessFlags.STATIC.getValue()) != 0) {
return Iterables.concat(super.getStaticFields(), ImmutableList.of(field));
}
return super.getStaticFields();
}
};
}
return super.rewrite(classDef);
}
};
}
});
return rewriter.rewriteDexFile(dexFile);
}
示例12: writeAccessFlags
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private static void writeAccessFlags(IndentingWriter writer, int accessFlags)
throws IOException {
for (AccessFlags accessFlag : AccessFlags.getAccessFlagsForMethod(accessFlags)) {
writer.write(accessFlag.toString());
writer.write(' ');
}
}
示例13: writeParameters
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private static void writeParameters(IndentingWriter writer, Method method,
List<? extends MethodParameter> parameters,
baksmaliOptions options) throws IOException {
boolean isStatic = AccessFlags.STATIC.isSet(method.getAccessFlags());
int registerNumber = isStatic ? 0 : 1;
for (MethodParameter parameter : parameters) {
String parameterType = parameter.getType();
String parameterName = parameter.getName();
Collection<? extends Annotation> annotations = parameter.getAnnotations();
if (parameterName != null || annotations.size() != 0) {
writer.write(".param p");
writer.printSignedIntAsDec(registerNumber);
if (parameterName != null && options.outputDebugInfo) {
writer.write(", ");
ReferenceFormatter.writeStringReference(writer, parameterName);
}
writer.write(" # ");
writer.write(parameterType);
writer.write("\n");
if (annotations.size() > 0) {
writer.indent(4);
String containingClass = null;
if (options.useImplicitReferences) {
containingClass = method.getDefiningClass();
}
AnnotationFormatter.writeTo(writer, annotations, containingClass);
writer.deindent(4);
writer.write(".end param\n");
}
}
registerNumber++;
if (TypeUtils.isWideType(parameterType)) {
registerNumber++;
}
}
}
示例14: canAccessClass
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private boolean canAccessClass(@Nonnull ClassDef accessorClassDef, @Nonnull ClassDef accesseeClassDef) {
if (AccessFlags.PUBLIC.isSet(accesseeClassDef.getAccessFlags())) {
return true;
}
// Classes can only be public or package private. Any private or protected inner classes are actually
// package private.
return getPackage(accesseeClassDef.getType()).equals(getPackage(accessorClassDef.getType()));
}
示例15: writeAccessFlags
import org.jf.dexlib2.AccessFlags; //导入依赖的package包/类
private static void writeAccessFlags(IndentingWriter writer, int accessFlags)
throws IOException {
for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForMethod(accessFlags)) {
writer.write(accessFlag.toString());
writer.write(' ');
}
}