/** * Replaces any interaction with a matched byte code element with a non-static field access on the first * parameter of the matched element. When matching a non-static field access or method invocation, the * substituted field is located on the same receiver type as the original access. For static access, the * first argument is used as a receiver. * * @param matcher A matcher for locating a field on the original interaction's receiver type. * @return A member substitution that replaces any matched byte code element with an access of the matched field. */ public MemberSubstitution replaceWithField(ElementMatcher<? super FieldDescription> matcher) { return replaceWith(new Substitution.ForFieldAccess.OfMatchedField(matcher)); }