public class X { void f(Foo foo, Bar bar) { bar.setFamilyName(foo.getName()); } }