public byte[] build(ClassDef classDef) { log.debug("Building input class: {}", classDef); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS); visitClass(classDef, classWriter); visitFields(classDef.getFields(), classWriter, classDef.getAccessFlags()); if ((classDef.getAccessFlags() & Opcodes.ACC_ENUM) != 0) { visitEnumMethods(classDef, classDef.getFields(), classWriter); } else { visitMethods(classDef, classDef.getMethods(), classWriter); } classWriter.visitEnd(); return classWriter.toByteArray(); }
for (Method method : classDef.getMethods()) { MethodImplementation methodImpl = method.getImplementation(); if (methodImpl != null) {
@Override public Method read(String className, String member) throws Exception { org.jf.dexlib2.iface.ClassDef classDef = (org.jf.dexlib2.iface.ClassDef) reader.read(className,null); for(Method method:classDef.getMethods()){ if (method.getName().equals(member)){ return method; } } return null; } }
if (typeProto instanceof ClassProto) { ClassDef classDef = ((ClassProto)typeProto).getClassDef(); for (Method method: classDef.getMethods()) { if (method.equals(methodRef)) { resolved = true;
if (typeProto instanceof ClassProto) { ClassDef classDef = ((ClassProto)typeProto).getClassDef(); for (Method method: classDef.getMethods()) { if (method.equals(methodRef)) { resolved = true;
if (typeProto instanceof ClassProto) { ClassDef classDef = ((ClassProto)typeProto).getClassDef(); for (Method method: classDef.getMethods()) { if (method.equals(methodRef)) { resolved = true;
for(Method method: classDef.getMethods()) { ControlFlowGraph cfg = new ControlFlowGraph(method);
private static List<Method> reDexMethods(@Nonnull ClassDef classDef) { List<Method> taintedMethods = Lists.newArrayList(); for (Method method : classDef.getMethods()) { MethodImplementation implementation = method.getImplementation(); MutableMethodImplementation mutableImplementation = new MutableMethodImplementation(implementation); taintedMethods.add(new ImmutableMethod( method.getDefiningClass(), method.getName(), method.getParameters(), method.getReturnType(), method.getAccessFlags(), method.getAnnotations(), mutableImplementation)); } return taintedMethods; }
for (Method method: classDef.getMethods()) { MethodImplementation methodImpl = method.getImplementation(); if (methodImpl != null) {
for (Method method: classDef.getMethods()) { MethodImplementation methodImpl = method.getImplementation(); if (methodImpl != null) {
for (Method method: classDef.getMethods()) { MethodImplementation methodImpl = method.getImplementation(); if (methodImpl != null) {
for (Method method : classDef.getMethods()) { MethodImplementation methodImpl = method.getImplementation(); if (methodImpl != null) {
@Override public ClassDef reClassDef(ClassDef classDef) { Iterable<? extends Method> methods = classDef.getMethods(); LinkedHashSet<Method> newMethods = new LinkedHashSet<Method>(); Iterable<? extends Field> fields = classDef.getFields();
private void verifyDexFile(DexFile dexFile) { Assert.assertEquals(1, dexFile.getClasses().size()); ClassDef cls = Lists.newArrayList(dexFile.getClasses()).get(0); Assert.assertEquals("Lcls1;", cls.getType()); Assert.assertEquals(1, Lists.newArrayList(cls.getMethods()).size()); Method method = Iterators.getNext(cls.getMethods().iterator(), null); Assert.assertEquals("method1", method.getName()); Assert.assertEquals(1, Lists.newArrayList(method.getImplementation().getInstructions()).size()); Instruction instruction = Lists.newArrayList(method.getImplementation().getInstructions().iterator()).get(0); Assert.assertEquals(Opcode.INVOKE_CUSTOM, instruction.getOpcode()); Assert.assertTrue(((Instruction35c) instruction).getReference() instanceof CallSiteReference); } }
Assert.assertNotNull(accessorsClass); for (Method method: accessorsClass.getMethods()) { Matcher m = accessorMethodPattern.matcher(method.getName()); if (!m.matches()) {
for (Method method: classDef.getMethods()) { if (method.getName().equals("main")) { mainMethod = method;
for (Method method: classDef.getMethods()) { if (method.getName().equals("main")) { mainMethod = method;
Set<Method> methods = Sets.newConcurrentHashSet(); boolean modifiedMethod = false; for (Method method : classDef.getMethods()) { MethodImplementation implementation = method.getImplementation(); if (implementation != null&&(methodNeedsModification(classDef, method, isAndFix))) {
Assert.assertNotNull(classDef); Method method = Iterables.getFirst(classDef.getMethods(), null); Assert.assertNotNull(method);
Assert.assertNotNull(classDef); Method method = Iterables.getFirst(classDef.getMethods(), null); Assert.assertNotNull(method);