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); }
if (!AccessFlags.ABSTRACT.isSet(interfaceMethod.getAccessFlags())) { ClassProto existingInterface = (ClassProto)classPath.getClass( defaultMethods.get(defaultMethodIndex).getDefiningClass()); if (!AccessFlags.ABSTRACT.isSet(interfaceMethod.getAccessFlags())) { if (!AccessFlags.ABSTRACT.isSet(interfaceMethod.getAccessFlags())) { defaultMethods.add(interfaceMethod); methodOrder.put(interfaceMethod, methodOrder.size());
if (!AccessFlags.ABSTRACT.isSet(interfaceMethod.getAccessFlags())) { ClassProto existingInterface = (ClassProto)classPath.getClass( defaultMethods.get(defaultMethodIndex).getDefiningClass()); if (!AccessFlags.ABSTRACT.isSet(interfaceMethod.getAccessFlags())) { if (!AccessFlags.ABSTRACT.isSet(interfaceMethod.getAccessFlags())) { if (oldVtableMethod != null) { if (!interfaceMethodOverrides(interfaceMethod, oldVtableMethod)) {
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); }
method_stack.peek().isStatic = AccessFlags.STATIC.isSet(accessFlags); method_stack.peek().methodParameterRegisters = MethodUtil.getParameterRegisterCount((method_name_and_prototype69!=null?((smaliTreeWalker.method_name_and_prototype_return)method_name_and_prototype69).parameters:null), method_stack.peek().isStatic);
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) {
boolean isStatic = AccessFlags.STATIC.isSet(classSection.getMethodAccessFlags(methodKey)); Collection<? extends TypeKey> parameters = typeListSection.getTypes( protoSection.getParameters(methodSection.getPrototype(methodKey)));
if (!AccessFlags.STATIC.isSet(accessFlags) && field_initial_value19 != null) { throw new SemanticException(input, "Initial field values can only be specified for static fields.");
public void writeTo(IndentingWriter writer) throws IOException { int parameterRegisterCount = 0; if (!AccessFlags.STATIC.isSet(method.getAccessFlags())) { parameterRegisterCount++;
public static boolean isStatic(@Nonnull Field field) { return AccessFlags.STATIC.isSet(field.getAccessFlags()); }
public static boolean isStatic(@Nonnull Field field) { return AccessFlags.STATIC.isSet(field.getAccessFlags()); }
public static boolean isStatic(@Nonnull Method method) { return AccessFlags.STATIC.isSet(method.getAccessFlags()); }
public static boolean isStatic(@Nonnull Field field) { return AccessFlags.STATIC.isSet(field.getAccessFlags()); }
public static boolean isStatic(@Nonnull Method method) { return AccessFlags.STATIC.isSet(method.getAccessFlags()); }
public static boolean isStatic(@Nonnull Method method) { return AccessFlags.STATIC.isSet(method.getAccessFlags()); }
public static boolean canAccessClass(@Nonnull String accessorType, @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(accessorType)); }
public static boolean canAccessClass(@Nonnull String accessorType, @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(accessorType)); }
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())); }
@Test public void should_remove_final_modifier_from_the_given_class() throws IOException { ImmutableClassDef def = new ImmutableClassDef("Lfoo/Bar;", AccessFlags.FINAL.getValue(), "Ljava/lang/Object;", null, null, null, null, null); byte[] bytecode = DexPoolUtils.toBytecode(new ImmutableDexFile(Opcodes.getDefault(), Collections.singleton(def))); DexRewriter rewriter = new DexRewriter(new FinalModifierRemoverModule()); ClassDef out = rewriter.getClassDefRewriter() .rewrite(new DexBackedDexFile(null, bytecode) .getClasses() .iterator() .next()); assertFalse(AccessFlags.FINAL.isSet(out.getAccessFlags())); }