My favorites | Sign in
Google
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
                
New issue | Search
for
| Advanced search | Search tips
Issue 785: JSNI call to toString fails
  Back to list
 
Reported by gwt.team.jat, Mar 08, 2007
Found in GWT Release:
trunk, r575

Detailed description:
HostedTest.testJSNIToStringResolution fails on OSX and Windows.  This test
attempts to call the Java toString method from JavaScript using
JavaScript's toString method on a wrapped Java object.  In OSX, it doesn't
wind up calling the Java toString method but returns something reasonable.
 In Windows, it crashes because IDispatchProxy.invoke doesn't support the
case of dispId=0/flags=COM.DISPATCH_METHOD.

Workaround if you have one:
none

Links to the relevant GWT Developer Forum posts:
none
Comment 1 by gwt.team.jat, Mar 08, 2007
Left out summary line.
Summary: JSNI call to toString fails
Comment 2 by gwt.team.morrildl, Mar 08, 2007
See also  bug 775 ?
Comment 3 by gwt.team.jat, Mar 08, 2007
Yes, 775 is the same issue just for OSX.
Cc: gwt.team.knorton
Comment 4 by gwt.team.scottb, Mar 09, 2007
I think this is a newly-introduced bug in Windows, caused by my fiddling with the
handling of id 0.  Here's the problem:

0 is magic magic magic; DISPATCH_METHOD means to do an explicit invoke on the object,
DISPATCH_PROPERTYGET means to do an explicit String conversion on the object.  Fine.

Now, on any other disp id, it must refer to some field on the object.  In this case,
DISPATCH_PROPERTYGET means to get the value of the field, which could be a simple
field get or an attempt to "tear-off" a method.  DISPATCH_METHOD means to invoke on
that id.  All still fine.

The problem comes up because we've reserved id 0 for "toString" (that is JavaScript
toString as opposed to the JSNI ident "@java.lang.Object::toString()").  This happens
in DispatchClassInfo.lazyInitTargetMembers().  In retrospect, this was probabaly a
bad choice.

You'll notice that ie.MethodDispatch actually puts "toString" in id 1, which works
perfectly.  I think the right solution is to truly reserve 0 for implicit things, put
toString at 1, and put everything else starting at 2.

Labels: -Priority-Medium Priority-High Milestone-1_4_RC
Comment 5 by gwt.team.scottb, Apr 09, 2007
(No comment was entered for this change.)
Owner: gwt.team.scottb
Cc: gwt.team.jat
Comment 6 by gwt.team.scottb, Apr 11, 2007
Fixed in r840.
Status: FixedNotReleased
Comment 7 by gwt.team.bruce, May 29, 2007
Changing to Fixed status with GWT 1.4 RC release
Status: Fixed
Comment 8 by sumitcha...@google.com, Apr 28, 2008
 
Owner: scottb
Comment 9 by knorton+personal@google.com, Apr 29, 2008
 
Comment 10 by knorton+personal@google.com, Apr 29, 2008
 
Comment 11 by knorton+personal@google.com, Apr 29, 2008
 
Cc: -gwt.team.knorton knor...@google.com
Comment 12 by sumitcha...@google.com, May 02, 2008
 
Cc: -gwt.team.jat j...@google.com
Sign in to add a comment