Friday, November 30, 2012

Looks like a GWT compiler and/or GIN error.

I've got a class, TestPlace, that derives from Place that takes two parameters, both Strings.

I use GIN so I have a PlaceFactory to create instances of my places.  It has a method for creating TestPlace that has two String parameters.

It all looks pretty straight forward, except that inside the TestPlace constructor, both strings end up being the first parameter in the call to the factory method!

Here's the TestPlace constructor:
<pre>
@Inject
public TestPlace (@Assisted String testId, @Assisted String authType) {
logger.fine("testId: " + testId+ "; authType: " + authType);
this.testId= testId;
this.authType = authType;
}
</pre>
It has the @Inject and @Assisted annotations, as you would expect.

The method signature in the PlaceFactory interface looks like this:
<pre>
TestPlace createTestPlace(String testId, String authType);
</pre>
Everything looks pretty normal so far.  However, the log shows that the createTestPlace caller is calling with two different strings, but inside the TestPlace constructor, the strings are identical.

When createTestPlace is compiled to JavaScript, it looks like this:
<pre>
function $createTestPlace(p0){
  var result;
  result = new TestPlace_0(p0, p0);
  return result;
}
</pre>
Notice how it has just one parameter, which it uses twice when calling the TestPlace constructor.

Similarly, the JavaScript call to createTestPlace only has the first parameter.  The second parameter, which is clearly there in the Java, is missing the JavaScript.

Anyone have any ideas what's going on here?

Started seeing this in GWT 2.4. Tonight I upgraded to 2.5 but the problem is still there.  Also using gin-1.5-post-gwt-2.2.jar.

--
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/-/mW6fUK_6X30J.
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