I am making a GWT framework similar to Swing framework.
In GWT, I have one method in which I am making a anonymous class in method, but the problem is when this method executes, the execution control does not go to anonymous class instead it skips 开发者_开发技巧over it.
After this method executes completely, the control is transfered to the anonymous class. And this thing is working perfectly fine in Swing.
public void model(){
System.out.println("This line is executing");
DataListModel model = new DataListModel() {
public void setRecords(List records) {
System.out.println("I see this line after model() executes completely");
int i = 0;
records = new LinkedList(records);
}
}
System.out.println("this line is executed without executing DataListModel.setRecords()");
}
The problem is that the DataListModel model = new DataListModel...
line doesn't actually execute anything. It creates a new instance, but unless either the DataListModel
constructor calls setRecords
(which it probably doesn't) or you use the model
variable in some way that calls setRecords
, setRecords
will never be called.
精彩评论