Wednesday, October 5, 2011

Re: Permutation, code splitting and deferred property

Thanks David for the follow-up.

> Could this be a result of the new PersistentUnitCache / generator caching
> stuff?
I tried having a different generator class for each value but I still
had the same issue.

> Also, Soft Permutations would cause this, so make sure those are not on.
I don't use the <collapse-property> tag so if I'm correct, they aren't
soft permutations.

I was able to reproduce the issue using <replace-with> tag in a simple
case. I had the following code:

public class Widget1 … {}

public class Widget11 extends Widget1 {

public void oneMethod(){
GWT.runAsync(new RunAsyncCallback {
@Override
public void onSuccess() {
Widget w2 = new Widget2();
...
}
...
}
….
}

public class Widget12 extends Widget1 {

public void oneMethod(){
GWT.runAsync(new RunAsyncCallback {
@Override
public void onSuccess() {
Widget w2 = new Widget2();
...
}
...
}
….
}

and have the following configuration:
<replace-with class="com.test.client.Widget11">
<when-type-is class="com.test.client.Widget1"/>
</replace-with>

<replace-with class="com.test.client.Widget12">
<when-type-is class="com.test.client.Widget1"/>
<when-property-is name="user.agent" value="gecko1_8" />
</replace-with>

and then I just create a widget1 in my entry point:
public void onModuleLoad() {
w1 = GWT.create( Widget1.class );
...
}

When I look at the soyc report, for any permutation, GWT detects 2
split points and all the code of Widget2 is in the left-over fragment.
I'm not sure why GWT detects 2 split points because when you look at
the full code size report, only one of the 2 classes is here (which is
the expected behavior).

If it can help, you can find the code here: http://mvp4g.googlecode.com/svn/temp/gwt-example2.zip

Also this happens only with gwt-2.4.0 but it works fine with
gwt-2.3.0. Could it be a bug with gwt-2.4.0 (but I have to admit it is
a pretty rare case)?

I found one workaround in my case by creating an extra class that
contains the split point:

public class SplitWidget2(){

public void split(RunAsyncCallback callback){
GWT.runAsync(callback);
}

}

and then in Widget11 and Widget12:
public class Widget11 extends Widget1 {

public void oneMethod(){
newSplitWidget2().split(new RunAsyncCallback {
@Override
public void onSuccess() {
Widget w2 = new Widget2();
...
}
...
}
….
}


Thanks for your help,
Pierre

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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