Class A
private X x;
public Method(X x) {
this.x = x;
}
public void stuff() {
Method2 m2 = new Method();
m2.doThis(x);
}
Class B
public Method2() {
}
public void doThis(X x) {
X copyOfX = x;
// MAKE CHANGES TO copyOfX here
}
What happens is. When I make changes to the copyOfX in class B - the original also ends up being changed. I've been pulling my hair out for several hours trying to find wtf is going on and just had to end up asking.