Use a final variable/parameter to be able to access it in an anonymous inner class. This is necessary since the anonymous class will make copies of all outer local fields used, and so they must be made final so that their values (usually the reference values) don't change.
public Test(final ClassA instanceA){