interface Foreign { void foo(Test1 test1); } class ForeignImpl implements Foreign { public void foo(Test1 test1) { test1.field++; } } public abstract class Test1 { int field; void bar () { new ForeignImpl().foo(this); } }