On 2011/07/08 19:07:11, scottb wrote:
Legally tho, it doesn't make sense for a single class to have more
than one
method with the same signature.  Maybe that should be an assertion
somewhere.

On Thu, Jul 7, 2011 at 8:57 PM, <mailto:cromwell...@google.com> wrote:

>
> Should we really be fixing the issue here, or should we just fix it
up
> in GenerateJavaScriptAST or JsNamer? There are lots of locations in
the
> GWT compiler where methods and fields are synthesized, so I would
bet
> that there are other collisions like this lurking, just not being
> tripped.
>
> Another option would be something like a utility method like
> Util.createUniqueName(prefix, suffix, scope context), which could be
> reused.
>
I thought the problem was limited to pretty naming, but I was wrong.  In
my isolated test case, -style OBF generates duplicate function names as
well.

function u(a){var b;return b=a,Jc(b)?b.d():v()}
function u(a){var b;return b=a,Jc(b)?b.d():x()}

After investigating, it turns out that JsNamer is too late to catch the
problem because the JsScope doesn't actually contain duplicate names.

What seems to be happening is two methods sharing the same JsName
instance.  I traced it back to JProgram.createMethod() where the method
gets added to one of the indexed methods.  A collision there generates
two methods that somehow share the same JsName.

What I chose to do was to just thrown an ICE if a problem was detected
there.  As it turns out, there was a bug in BuildTypeMap.java, but
that's been superseded by the new GwtAstBuilder.


http://gwt-code-reviews.appspot.com/1467812/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to