make static: move field initialization to constructors if it depends on introduced fields

This commit is contained in:
anna
2010-02-03 15:50:22 +03:00
parent 992b49b219
commit 4b271bdb3d
4 changed files with 78 additions and 0 deletions
@@ -0,0 +1,13 @@
public class YoYo {
Object y;
class <caret>YoYoYo {
Object x = y;
Object[] xx = {y};
void foo (){
YoYo yoYoy = YoYo.this;
Object t = y;
Object t1 = yoYoy.y;
}
}
}
@@ -0,0 +1,23 @@
public class YoYo {
Object y;
static class YoYoYo {
Object x;
Object[] xx;
private YoYo anObject;
private Object y;
public YoYoYo(YoYo anObject, Object y) {
this.anObject = anObject;
this.y = y;
this.x = y;
this.xx = new Object[]{y};
}
void foo (){
YoYo yoYoy = anObject;
Object t = y;
Object t1 = yoYoy.y;
}
}
}