hey guys,
i think we have a massive problem with the generated js sources for
production. we built a larger app and since now all worked like a
charm, we had not a single stopper.
at the moment there is a strange issue. when i use the static app it
seems like there is a confusion about the generic-type or the content
of it. let me first show you the gwttest i wrote to let you see what
happens::
package net.vz.common.widgets.client.profile.lastvisitors;
import java.util.List;
import java.util.logging.Logger;
import net.vz.common.services.client.registry.Registry;
import net.vz.common.services.client.restdto.GenericListDto;
import net.vz.common.services.client.restdto.MinUserDto;
import net.vz.common.services.client.restservice.UserService;
import
net.vz.common.services.client.resty.vzcore.SimpleMethodCallback;
import net.vz.common.widgets.client.bundles.UnifiedResources;
import net.vz.common.widgets.client.i18n.LocalMessages;
import net.vz.common.widgets.client.listitem.GenericImageSlider;
import net.vz.common.widgets.client.listitem.GenericList;
import net.vz.common.widgets.client.listitem.renderer.MinUserRenderer;
import
net.vz.common.widgets.client.simpleItem.inject.SimpleItemModule;
import net.vz.common.widgets.client.toolbox.custompanels.ListPanel;
import net.vz.common.widgets.client.toolbox.slideBar.SlideBarActivity;
import net.vz.common.widgets.client.toolbox.slideBar.SlideBarView;
import net.vz.common.widgets.client.toolbox.slideBar.SlideBarViewImpl;
import org.fusesource.restygwt.client.Method;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.SimplePanel;
/**
* try to reconstruct a production bug which seems to be caused by
wrong typing
* from gwt??!
*
* @author abalke
*/
public class ProfileLastVisitorsActivityTestGwt extends GWTTestCase {
private static final String userKey = "U:test_user";
@Override
public String getModuleName() {
return SimpleItemModule.MODULE_NAME;
}
public void testDo() {
LocalMessages localMessages = GWT.create(LocalMessages.class);
UnifiedResources unifiedResources = new UnifiedResources();
ListPanel ul = GWT.create(ListPanel.class);
SlideBarView sidebarView = GWT.create(SlideBarViewImpl.class);
SlideBarActivity slideBarActivity = new
SlideBarActivity(sidebarView);
GenericList<MinUserDto> genericLinkList = new
GenericList<MinUserDto>(unifiedResources);
GenericImageSlider<MinUserDto> slider = new
GenericImageSlider<MinUserDto>(
ul, slideBarActivity, genericLinkList,
unifiedResources);
ProfileLastVisitorsViewImpl__ view =
new ProfileLastVisitorsViewImpl__(localMessages);
UserService userService = GWT.create(UserService.class);
MinUserRenderer renderer = new MinUserRenderer();
AcceptsOneWidget panel = new SimplePanel();
SimpleEventBus eventBus = new SimpleEventBus();
ProfileLastVisitorsActivity a = new
ProfileLastVisitorsActivity(
view, userService, slider, renderer) {
protected void loadLastVisitors(String userId) {
userService.getLastVisitors(userId, new
SimpleMethodCallback<GenericListDto<MinUserDto>>() {
@Override
public void onSuccess(Method method,
GenericListDto<MinUserDto> response) {
List<MinUserDto> items = response.getItems();
if (Registry.canLog()) {
Logger.getLogger(ProfileLastVisitorsActivity.class.getName())
.info("got a list of " +
MinUserDto.class + ": " );
Logger.getLogger(ProfileLastVisitorsActivity.class.getName())
.info("... " + items.get(0));
}
slider.render(items);
view.setLastVisitorsOverallCount(response.getCount());
view.show(true);
// in production, here is a wrong type
assertEquals(MinUserDto.class,
items.get(0).getClass());
assertEquals(true,
((ProfileLastVisitorsViewImpl__)view).getShowState());
finishTest();
}
});
}
};
a.start(panel, eventBus);
// the widget wants only to be loaded when this is my user
Registry.MY_USER_ID = userKey;
assertEquals(false, view.getShowState());
a.update(userKey);
delayTestFinish(5 * 1000);
}
class ProfileLastVisitorsViewImpl__ extends
ProfileLastVisitorsViewImpl {
private boolean isShown = false;
public ProfileLastVisitorsViewImpl__(LocalMessages
localMessages) {
super(localMessages);
}
@Override
public void show(boolean b) {
isShown = b;
super.show(b);
}
public boolean getShowState() {
return isShown;
}
}
}
in production mode (static compile) i see in the logs that there is a
list of type ``A`` containing the first element of type ``B`` on this
place, which is overridden in the test above::
protected void loadLastVisitors(String userId) {
userService.getLastVisitors(userId, new
SimpleMethodCallback<GenericListDto<MinUserDto>>() {
@Override
public void onSuccess(Method method,
GenericListDto<MinUserDto> response) {
List<MinUserDto> items = response.getItems();
if (Registry.canLog()) {
Logger.getLogger(ProfileLastVisitorsActivity.class.getName())
.info("should have a list of " +
MinUserDto.class + ", first element is a: " +items.get(0));
}
slider.render(items);
view.setLastVisitorsOverallCount(response.getCount());
view.show(true);
}
});
}
in result of that i get a classcastexception - but only in compiled
production code. neither the integration-test, nor the hosted mode
with exactly the same backend-responses fails.
my question is now: have you ever seen an issue with type-confusion in
a bigger context? what should i do to come to a result with this
issue. if you tell me where to look in the compiled code i can try to
reduce the setup.
as a last option i only see to reduce my project to a minimum size
where the error still occurs to send it to you and file a bug.
any hints are greatly appreciated.
andi
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.