org.jf.dexlib2.iface.instruction.ReferenceInstruction Java Examples

The following examples show how to use org.jf.dexlib2.iface.instruction.ReferenceInstruction. 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: MethodInvocationInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Determine if register is used as object.
 *
 * Abstraction for static and non-static methods. Non-static methods need to ignore the first parameter (this)
 * @param isStatic if this method is static
 */
protected boolean isUsedAsObject(DexBody body, int register, boolean isStatic) {
    MethodReference item = (MethodReference) ((ReferenceInstruction) instruction).getReference();
    List<? extends CharSequence> paramTypes = item.getParameterTypes();
    List<Integer> regs = getUsedRegistersNums();
    if (paramTypes == null)
        return false;

    // we call a method on the register
    if (!isStatic && regs.get(0) == register)
        return true;

    // we call a method with register as a reftype paramter
    for (int i = 0, j = 0; i < regs.size(); i++, j++) {
        if (!isStatic && i == 0) {
            j--;
            continue;
        }

        if (regs.get(i) == register && (DexType.toSoot(paramTypes.get(j).toString()) instanceof RefType))
            return true;
        if (DexType.isWide(paramTypes.get(j).toString()))
            i++;
    }
    return false;
}
 
Example #2
Source File: ConstClassInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      if(!(instruction instanceof Instruction21c))
          throw new IllegalArgumentException("Expected Instruction21c but got: "+instruction.getClass());

      ReferenceInstruction constClass = (ReferenceInstruction) this.instruction;

      TypeReference tidi = (TypeReference)(constClass.getReference());
      String type = tidi.getType();
      if (type.startsWith("L") && type.endsWith(";"))
        type = type.replaceAll("^L", "").replaceAll(";$", "");

      int dest = ((OneRegisterInstruction) instruction).getRegisterA();
      Constant cst = ClassConstant.v(type);
      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cst);
      setUnit(assign);
      addTags(assign);
      body.add(assign);

if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        //DalvikTyper.v().captureAssign((JAssignStmt)assign, op); //TODO: classtype could be null!
        DalvikTyper.v().setType(assign.getLeftOpBox(), cst.getType(), false);
      }
  }
 
Example #3
Source File: SputInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      int source = ((OneRegisterInstruction)instruction).getRegisterA();
      FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
      StaticFieldRef instanceField = Jimple.v().newStaticFieldRef(getStaticSootFieldRef(f));
      Local sourceValue = body.getRegisterLocal(source);
      assign = getAssignStmt(body, sourceValue, instanceField);
      setUnit(assign);
      addTags(assign);
      body.add(assign);

if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        DalvikTyper.v().setType(assign.getRightOpBox(), instanceField.getType(), true);
      }
  }
 
Example #4
Source File: IputInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      TwoRegisterInstruction i = (TwoRegisterInstruction)instruction;
      int source = i.getRegisterA();
      int object = i.getRegisterB();
      FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
      InstanceFieldRef instanceField = Jimple.v().newInstanceFieldRef(body.getRegisterLocal(object),
                           getSootFieldRef(f));
      Local sourceValue = body.getRegisterLocal(source);
      assign = getAssignStmt(body, sourceValue, instanceField);
      setUnit(assign);
      addTags(assign);
      body.add(assign);

if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        DalvikTyper.v().setType(assign.getRightOpBox(), instanceField.getType(), true);
      }
  }
 
Example #5
Source File: IgetInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      TwoRegisterInstruction i = (TwoRegisterInstruction)instruction;
      int dest = i.getRegisterA();
      int object = i.getRegisterB();
      FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
      InstanceFieldRef r = Jimple.v().newInstanceFieldRef(body.getRegisterLocal(object),
                                                          getSootFieldRef(f));
      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), r);
      setUnit(assign);
      addTags(assign);
      body.add(assign);
      
if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        DalvikTyper.v().setType(assign.getLeftOpBox(), r.getType(), false);
      }
  }
 
Example #6
Source File: InstructionRewriter.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Nonnull @Override public Instruction rewrite(@Nonnull Instruction instruction) {
    if (instruction instanceof ReferenceInstruction) {
        switch (instruction.getOpcode().format) {
            case Format20bc:
                return new RewrittenInstruction20bc((Instruction20bc)instruction);
            case Format21c:
                return new RewrittenInstruction21c((Instruction21c)instruction);
            case Format22c:
                return new RewrittenInstruction22c((Instruction22c)instruction);
            case Format31c:
                return new RewrittenInstruction31c((Instruction31c)instruction);
            case Format35c:
                return new RewrittenInstruction35c((Instruction35c)instruction);
            case Format3rc:
                return new RewrittenInstruction3rc((Instruction3rc)instruction);
            default:
                throw new IllegalArgumentException();
        }
    }
    return instruction;
}
 
Example #7
Source File: InstructionRewriter.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Nonnull @Override public Instruction rewrite(@Nonnull Instruction instruction) {
    if (instruction instanceof ReferenceInstruction) {
        switch (instruction.getOpcode().format) {
            case Format20bc:
                return new RewrittenInstruction20bc((Instruction20bc)instruction);
            case Format21c:
                return new RewrittenInstruction21c((Instruction21c)instruction);
            case Format22c:
                return new RewrittenInstruction22c((Instruction22c)instruction);
            case Format31c:
                return new RewrittenInstruction31c((Instruction31c)instruction);
            case Format35c:
                return new RewrittenInstruction35c((Instruction35c)instruction);
            case Format3rc:
                return new RewrittenInstruction3rc((Instruction3rc)instruction);
            default:
                throw new IllegalArgumentException();
        }
    }
    return instruction;
}
 
Example #8
Source File: MethodInvocationInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Determine if register is used as floating point.
 *
 * Abstraction for static and non-static methods. Non-static methods need to ignore the first parameter (this)
 * @param isStatic if this method is static
 */
protected boolean isUsedAsFloatingPoint(DexBody body, int register, boolean isStatic) {
    MethodReference item = (MethodReference) ((ReferenceInstruction) instruction).getReference();
    List<? extends CharSequence> paramTypes = item.getParameterTypes();
    List<Integer> regs = getUsedRegistersNums();
    if (paramTypes == null)
        return false;

    for (int i = 0, j = 0; i < regs.size(); i++, j++) {
        if (!isStatic && i == 0) {
            j--;
            continue;
        }

        if (regs.get(i) == register && isFloatLike(DexType.toSoot(paramTypes.get(j).toString())))
            return true;
        if (DexType.isWide(paramTypes.get(j).toString()))
            i++;
    }
    return false;
}
 
Example #9
Source File: DexWriter.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) {
    List<? extends Instruction> instructions = methodImplementation.getInstructions();

    for (int i=0; i<instructions.size(); i++) {
        Instruction instruction = instructions.get(i);

        if (instruction.getOpcode() == Opcode.CONST_STRING) {
            if (stringSection.getItemIndex(
                    (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) {
                methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO,
                        ((OneRegisterInstruction)instruction).getRegisterA(),
                        ((ReferenceInstruction)instruction).getReference()));
            }
        }
    }
}
 
Example #10
Source File: AtlasFrameworkPropertiesReader.java    From atlas with Apache License 2.0 6 votes vote down vote up
public LinkedHashMap<String,BundleListing.BundleInfo>read(String className,String memberName) throws Exception {

        if (reader!= null) {
            Method method = (Method) reader.read(className, memberName);
            if (method!= null){
                Iterable<? extends Instruction> instructions = method.getImplementation().getInstructions();
                for (Instruction instruction:instructions){
                    if (instruction instanceof ReferenceInstruction){
                        if (((ReferenceInstruction) instruction).getReferenceType()== 0){
                            StringReference s = (StringReference) ((ReferenceInstruction) instruction).getReference();
                            return BundleListingUtil.parseArray(s.getString(), (LinkedHashMap<String, BundleListing.BundleInfo>) map);
                        }
                    }
                }
            }
        }
        return null;
    }
 
Example #11
Source File: DexWriter.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) {
    List<? extends Instruction> instructions = methodImplementation.getInstructions();

    for (int i=0; i<instructions.size(); i++) {
        Instruction instruction = instructions.get(i);

        if (instruction.getOpcode() == Opcode.CONST_STRING) {
            if (stringSection.getItemIndex(
                    (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) {
                methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO,
                        ((OneRegisterInstruction)instruction).getRegisterA(),
                        ((ReferenceInstruction)instruction).getReference()));
            }
        }
    }
}
 
Example #12
Source File: DexWriter.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) {
    List<? extends Instruction> instructions = methodImplementation.getInstructions();

    for (int i=0; i<instructions.size(); i++) {
        Instruction instruction = instructions.get(i);

        if (instruction.getOpcode() == Opcode.CONST_STRING) {
            if (stringSection.getItemIndex(
                    (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) {
                methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO,
                        ((OneRegisterInstruction)instruction).getRegisterA(),
                        ((ReferenceInstruction)instruction).getReference()));
            }
        }
    }
}
 
Example #13
Source File: InstructionRewriter.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nonnull @Override public Instruction rewrite(@Nonnull Instruction instruction) {
    if (instruction instanceof ReferenceInstruction) {
        switch (instruction.getOpcode().format) {
            case Format20bc:
                return new RewrittenInstruction20bc((Instruction20bc)instruction);
            case Format21c:
                return new RewrittenInstruction21c((Instruction21c)instruction);
            case Format22c:
                return new RewrittenInstruction22c((Instruction22c)instruction);
            case Format31c:
                return new RewrittenInstruction31c((Instruction31c)instruction);
            case Format35c:
                return new RewrittenInstruction35c((Instruction35c)instruction);
            case Format3rc:
                return new RewrittenInstruction3rc((Instruction3rc)instruction);
            default:
                throw new IllegalArgumentException();
        }
    }
    return instruction;
}
 
Example #14
Source File: InstructionRewriter.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nonnull @Override public Instruction rewrite(@Nonnull Instruction instruction) {
    if (instruction instanceof ReferenceInstruction) {
        switch (instruction.getOpcode().format) {
            case Format20bc:
                return new RewrittenInstruction20bc((Instruction20bc)instruction);
            case Format21c:
                return new RewrittenInstruction21c((Instruction21c)instruction);
            case Format22c:
                return new RewrittenInstruction22c((Instruction22c)instruction);
            case Format31c:
                return new RewrittenInstruction31c((Instruction31c)instruction);
            case Format35c:
                return new RewrittenInstruction35c((Instruction35c)instruction);
            case Format3rc:
                return new RewrittenInstruction3rc((Instruction3rc)instruction);
            default:
                throw new IllegalArgumentException();
        }
    }
    return instruction;
}
 
Example #15
Source File: DexWriter.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) {
    List<? extends Instruction> instructions = methodImplementation.getInstructions();

    for (int i=0; i<instructions.size(); i++) {
        Instruction instruction = instructions.get(i);

        if (instruction.getOpcode() == Opcode.CONST_STRING) {
            if (stringSection.getItemIndex(
                    (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) {
                methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO,
                        ((OneRegisterInstruction)instruction).getRegisterA(),
                        ((ReferenceInstruction)instruction).getReference()));
            }
        }
    }
}
 
Example #16
Source File: CheckCastInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<Type> introducedTypes() {
    ReferenceInstruction i = (ReferenceInstruction) instruction;

    Set<Type> types = new HashSet<Type>();
    types.add(DexType.toSoot((TypeReference) i.getReference()));
    return types;
}
 
Example #17
Source File: NewArrayInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<Type> introducedTypes() {
    ReferenceInstruction i = (ReferenceInstruction) instruction;

    Set<Type> types = new HashSet<Type>();
    types.add(DexType.toSoot((TypeReference) i.getReference()));
    return types;
}
 
Example #18
Source File: InstanceOfInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<Type> introducedTypes() {
    ReferenceInstruction i = (ReferenceInstruction) instruction;

    Set<Type> types = new HashSet<Type>();
    types.add(DexType.toSoot((TypeReference) i.getReference()));
    return types;
}
 
Example #19
Source File: ConstClassInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<Type> introducedTypes() {
    ReferenceInstruction i = (ReferenceInstruction) instruction;

    Set<Type> types = new HashSet<Type>();
    types.add(DexType.toSoot((TypeReference) i.getReference()));
    return types;
}
 
Example #20
Source File: MethodInvocationInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public Set<Type> introducedTypes() {
    Set<Type> types = new HashSet<Type>();
    MethodReference method = (MethodReference) (((ReferenceInstruction) instruction).getReference());

    types.add(DexType.toSoot(method.getDefiningClass()));
    types.add(DexType.toSoot(method.getReturnType()));
    List<? extends CharSequence> paramTypes = method.getParameterTypes();
    if (paramTypes != null)
        for (CharSequence type : paramTypes)
            types.add(DexType.toSoot(type.toString()));

    return types;
}
 
Example #21
Source File: MethodInvocationInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Return the SootMethodRef for the invoked method.
 *
 * @param invType The invocation type
 */
private SootMethodRef getSootMethodRef(InvocationType invType) {
	if (methodRef != null)
		return methodRef;
	
    MethodReference mItem = (MethodReference) ((ReferenceInstruction) instruction).getReference();
    String tItem = mItem.getDefiningClass();

    String className = tItem;
    Debug.printDbg("tItem: ", tItem ," class name: ", className);
      if (className.startsWith("[")) {
        className = "java.lang.Object";
      } else {
        className = dottedClassName (tItem);
      }

    SootClass sc = SootResolver.v().makeClassRef(className);
    if (invType == InvocationType.Interface && sc.isPhantom())
    	sc.setModifiers(sc.getModifiers() | Modifier.INTERFACE);
    String methodName = mItem.getName();

    Type returnType = DexType.toSoot(mItem.getReturnType());
    List<Type> parameterTypes = new ArrayList<Type>();
    List<? extends CharSequence> paramTypes = mItem.getParameterTypes();
    if (paramTypes != null)
        for (CharSequence type : paramTypes)
            parameterTypes.add(DexType.toSoot(type.toString()));

    Debug.printDbg("sc: ", sc);
    Debug.printDbg("methodName: ", methodName);
    Debug.printDbg("parameterTypes: ");
    for (Type t: parameterTypes)
      Debug.printDbg(" t: ", t);
    Debug.printDbg("returnType: ", returnType);
    Debug.printDbg("isStatic: ", invType == InvocationType.Static);
    methodRef = Scene.v().makeMethodRef(sc, methodName, parameterTypes, returnType,
    		invType == InvocationType.Static);
    
    return methodRef;
}
 
Example #22
Source File: InstructionWriter.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
private int getReferenceIndex(ReferenceInstruction referenceInstruction) {
    switch (referenceInstruction.getOpcode().referenceType) {
        case ReferenceType.FIELD:
            return fieldSection.getItemIndex((FieldRefKey)referenceInstruction.getReference());
        case ReferenceType.METHOD:
            return methodSection.getItemIndex((MethodRefKey)referenceInstruction.getReference());
        case ReferenceType.STRING:
            return stringSection.getItemIndex((StringRef)referenceInstruction.getReference());
        case ReferenceType.TYPE:
            return typeSection.getItemIndex((TypeRef)referenceInstruction.getReference());
        default:
            throw new ExceptionWithContext("Unknown reference type: %d",
                    referenceInstruction.getOpcode().referenceType);
    }
}
 
Example #23
Source File: FilledArrayInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<Type> introducedTypes() {
    ReferenceInstruction i = (ReferenceInstruction) instruction;

    Set<Type> types = new HashSet<Type>();
    types.add(DexType.toSoot((TypeReference) i.getReference()));
    return types;
}
 
Example #24
Source File: NewInstanceInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<Type> introducedTypes() {
    ReferenceInstruction i = (ReferenceInstruction) instruction;

    Set<Type> types = new HashSet<Type>();
    types.add(DexType.toSoot((TypeReference) i.getReference()));
    return types;
}
 
Example #25
Source File: FieldInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<Type> introducedTypes() {
    Set<Type> types = new HashSet<Type>();
    // Aput instructions don't have references
    if (!(instruction instanceof ReferenceInstruction))
        return types;

    ReferenceInstruction i = (ReferenceInstruction) instruction;

    FieldReference field = (FieldReference) i.getReference();

    types.add(DexType.toSoot(field.getType()));
    types.add(DexType.toSoot(field.getDefiningClass()));
    return types;
}
 
Example #26
Source File: SgetInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public void jimplify (DexBody body) {
      int dest = ((OneRegisterInstruction)instruction).getRegisterA();
      FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
      StaticFieldRef r = Jimple.v().newStaticFieldRef(getStaticSootFieldRef(f));
      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), r);
      setUnit(assign);
      addTags(assign);
      body.add(assign);
      
if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        DalvikTyper.v().setType(assign.getLeftOpBox(), r.getType(), false);
      }
  }
 
Example #27
Source File: InstructionWriter.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
private int getReferenceIndex(ReferenceInstruction referenceInstruction) {
    switch (referenceInstruction.getOpcode().referenceType) {
        case ReferenceType.FIELD:
            return fieldSection.getItemIndex((FieldRefKey)referenceInstruction.getReference());
        case ReferenceType.METHOD:
            return methodSection.getItemIndex((MethodRefKey)referenceInstruction.getReference());
        case ReferenceType.STRING:
            return stringSection.getItemIndex((StringRef)referenceInstruction.getReference());
        case ReferenceType.TYPE:
            return typeSection.getItemIndex((TypeRef)referenceInstruction.getReference());
        default:
            throw new ExceptionWithContext("Unknown reference type: %d",
                    referenceInstruction.getOpcode().referenceType);
    }
}
 
Example #28
Source File: InstructionWriter.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
private int getReferenceIndex(ReferenceInstruction referenceInstruction) {
    switch (referenceInstruction.getOpcode().referenceType) {
        case ReferenceType.FIELD:
            return fieldSection.getItemIndex((FieldRefKey)referenceInstruction.getReference());
        case ReferenceType.METHOD:
            return methodSection.getItemIndex((MethodRefKey)referenceInstruction.getReference());
        case ReferenceType.STRING:
            return stringSection.getItemIndex((StringRef)referenceInstruction.getReference());
        case ReferenceType.TYPE:
            return typeSection.getItemIndex((TypeRef)referenceInstruction.getReference());
        default:
            throw new ExceptionWithContext("Unknown reference type: %d",
                    referenceInstruction.getOpcode().referenceType);
    }
}
 
Example #29
Source File: InstructionWriter.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
private int getReferenceIndex(ReferenceInstruction referenceInstruction) {
    switch (referenceInstruction.getOpcode().referenceType) {
        case ReferenceType.FIELD:
            return fieldSection.getItemIndex((FieldRefKey)referenceInstruction.getReference());
        case ReferenceType.METHOD:
            return methodSection.getItemIndex((MethodRefKey)referenceInstruction.getReference());
        case ReferenceType.STRING:
            return stringSection.getItemIndex((StringRef)referenceInstruction.getReference());
        case ReferenceType.TYPE:
            return typeSection.getItemIndex((TypeRef)referenceInstruction.getReference());
        default:
            throw new ExceptionWithContext("Unknown reference type: %d",
                    referenceInstruction.getOpcode().referenceType);
    }
}
 
Example #30
Source File: SyntheticAccessorResolver.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Nullable
public AccessedMember getAccessedMember(@Nonnull MethodReference methodReference) {
    String methodDescriptor = ReferenceUtil.getMethodDescriptor(methodReference);

    AccessedMember accessedMember = resolvedAccessors.get(methodDescriptor);
    if (accessedMember != null) {
        return accessedMember;
    }

    String type = methodReference.getDefiningClass();
    ClassDef classDef = classDefMap.get(type);
    if (classDef == null) {
        return null;
    }

    Method matchedMethod = null;
    MethodImplementation matchedMethodImpl = null;
    for (Method method: classDef.getMethods()) {
        MethodImplementation methodImpl = method.getImplementation();
        if (methodImpl != null) {
            if (methodReferenceEquals(method, methodReference)) {
                matchedMethod = method;
                matchedMethodImpl = methodImpl;
                break;
            }
        }
    }

    if (matchedMethod == null) {
        return null;
    }

    //A synthetic accessor will be marked synthetic
    if (!AccessFlags.SYNTHETIC.isSet(matchedMethod.getAccessFlags())) {
        return null;
    }

    List<Instruction> instructions = ImmutableList.copyOf(matchedMethodImpl.getInstructions());

    int accessType = SyntheticAccessorFSM.test(instructions);

    if (accessType >= 0) {
        AccessedMember member =
                new AccessedMember(accessType, ((ReferenceInstruction)instructions.get(0)).getReference());
        resolvedAccessors.put(methodDescriptor, member);
        return member;
    }
    return null;
}