Wednesday, November 28, 2012

Re: Generated class only appearing in one permutation

So I came back to this 2 weeks later and after much hair pulling finally figured out why this was happening. Figured it was worth answering my own question in case anyone else runs into this...

The issue was I was returning null from my generate method if the context.tryCreate(...) method was returning null (ie. when we've already generated this class before and don't need to create it again.)  Once I returned the class name even if it has already been created it started working in all permutations.

Hope someone benefits from this!

On Thursday, November 15, 2012 3:40:33 PM UTC-6, Paul Donnelly wrote:
I wrote two different generators (using GWT 2.5) to simplify a couple processes and automate the writing of boilerplate code.  It works just fine in dev mode.  What I'm noticing when I compile my app for production though, is the generated classes are only used in one of the permutations.  All other permutations use the "base" class.

* I can verify the generated classes are being created correctly and show up in the .generated folder.
* If I search, I can see the generated class name (ie. MyClassGenerated) shows up in only one of the many cache.html files. All other cache files use the base class and code (ie. MyClass).  Interestingly, by default and with all permutations, this always seems to be the Firefox one.
* When I specify user agents in my .gwt.xml file to "limit" the number of permutations, I still get one permutation with generated code, but the browser that works changes.

Otherwise, I don't think I'm doing anything crazy, my .gwt.xml file is pretty bare except for the "generate-with" declaration to generate my files.

I've tried just about all I can think of and searched the web without luck.  Anyone out there have any idea why it only uses the code in 1 permutation. Seems like it should work in all or none?  What would cause it to choose only 1? Is the a setting I'm missing? Or some optimization strategy that I haven't heard about?  I'm willing to wager I'm missing something stupid, but can't figure out what it is...

If seeing the code would help, I'd be happy to include snippets or class files.

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/FuAFbaSCXsYJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment