Do not do list (i.e. a reference point for new/migrate proj)

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Do not do list (i.e. a reference point for new/migrate proj)

Postby dhartford » Fri Oct 08, 2010 6:24 am

Hey all,
I was trying to migrate a project, and had some issues searching for 'things not to do' or 'common problems migrating to GWT Designer' and the like.

So, would like to start a quick-list of common problems. I have only had one so far, but it was days to track down --


"Error Loading Modules" - Process to determine inherited module with problem.
1) Create a 'cleanroom' module with an entrypoint and simple UI. Confirm the Designer still works fine.
2) From your problem project that may have multiple inherited modules from *.gwt.xml, copy one-by-one the modules and try your simple entry point until the Designer in your 'cleanroom' project has the "Error Loading Modules" problem. This has identified one of the problem module(s).


"Error Loading Modules" - do not do list:
*Direct shortcircuting - do not do the following:
Code: Select all
If (true){
  return;
}
Widget x = new Widget().....


Instead, if you really must do shortcircuts instead of other approaches, use a
Code: Select all
boolean shortcircut = true; if(shortcircut){
approach. I'm not condoning this approach, just during migrations things to watch out for.

-D
dhartford
 
Posts: 6
Joined: Fri Oct 08, 2010 6:16 am

Re: Do not do list (i.e. a reference point for new/migrate p

Postby Eric Clayberg » Fri Oct 08, 2010 9:59 am

dhartford wrote:"Error Loading Modules" - do not do list:
*Direct shortcircuting - do not do the following:

This is curious advice as I don't know what it refers to or why it is relevant.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Do not do list (i.e. a reference point for new/migrate p

Postby dhartford » Mon Oct 11, 2010 3:24 am

Direct Shortcircuting is the term I used when someone wants to skip a portion/all of a method and return right away.

I'll elaborate on the example I provided:
Code: Select all
public String helloworld(String name){
//shortcircut to avoid running below code
if(true){
return "Hello world.";
}
//actual code you want to run, abbreviated for demonstrations, but now skipped.
return "Hello " + name;
}


There seems to be circumstances that the Instantiations JDT does not like for the above, whether it's NativeEvents or Widgets I can not be more precise. The problem above introduces an "Error Loading Modules" exception that was very difficult to track down. By simply changing the if(true) to instead do boolean shortcircut=true;if(shortcircut) the Error Loading Modules goes away (I tested this several times and different places/scenarios, and couldn't believe it myself). All of the direct shortcircuts need to be corrected before the Error Loading Modules exception goes away. The specifics of my scenarios were all void returns, but the String return above was used for demonstration purposes.

To reiterate, I do not condone this practice, just something to watch out for during migrations.

-D
dhartford
 
Posts: 6
Joined: Fri Oct 08, 2010 6:16 am

Re: Do not do list (i.e. a reference point for new/migrate p

Postby Eric Clayberg » Mon Oct 11, 2010 5:59 am

dhartford wrote:There seems to be circumstances that the Instantiations JDT does not like for the above, whether it's NativeEvents or Widgets I can not be more precise.

I think you need to be much more precise and/or provide an actual test case. We have tried both patterns you described in multiple combinations and did not have any problems at all.

If by "Instantiations JDT", you are referring to the GWT Designer parser, it does not have any problem with either construct. Using either pattern will not cause any problems by itself.

I would look much more carefully at the actual code that is called within that block. For example, if you remove the condition completely and just call the short-circuit code directly (comment out the alternative path), does the same problem occur?

dhartford wrote:The problem above introduces an "Error Loading Modules" exception that was very difficult to track down.

A "Error Loading Modules" exception generally is caused by a GWT compiler failure and not something related to GWT Designer.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Do not do list (i.e. a reference point for new/migrate p

Postby dhartford » Tue Oct 12, 2010 5:39 am

Eric Clayberg wrote:For example, if you remove the condition completely and just call the short-circuit code directly (comment out the alternative path), does the same problem occur?


Yes, I did all this previously and that's what made this very difficult to figure out -- if you comment out the short-circuit and run the regular code, there is no "Error Loading Modules". If you leave the short-circut and comment out the regular code (that isn't being run anyway), again there are *no* "Error Loading Modules". It is only when both are in place.

I could not create a simple test-case to reproduce this either. The live-code that had the issue was a factory class (i.e. didn't extend anything) with one static variable (which is used in some of the problem areas, but not all of them, such that leaving both the short-circut and the regular code in cases where the static was *not* used did not change the outcome).

NativeEvent, Element, Map<String, String> are the types of classes used. I could not figure out the specifics, but at least found the work-around.
dhartford
 
Posts: 6
Joined: Fri Oct 08, 2010 6:16 am

Re: Do not do list (i.e. a reference point for new/migrate p

Postby Eric Clayberg » Tue Oct 12, 2010 6:18 am

dhartford wrote:
Eric Clayberg wrote:I could not create a simple test-case to reproduce this either.

As I suspected. The issue of the style of the short circuit is a red herring that really has nothing to do with this. The style of the short circuit will only effect the code that is seen by the parser since it will ignore code in conditionals except in the special case of a hard-coded "true" block (this is intentional). The real problem here (that is triggering the GWT "Error Loading Modules" issue) is in the code that is visited within the true block and how it interacts with any other code in that class.

With an actual test case, I'm sure we could identify exactly what is going on. All I can say at this point, however, is that the style of short circuit is not the actual cause of the problem.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests

cron