Hello Leeroy Jenkins,

I'd like you to reexamine a change.  Please visit

    https://gwt-review.googlesource.com/3361

to look at the new patch set (#2).

Change subject: Ensure clinits get called for JSO instance methods.
......................................................................

Ensure clinits get called for JSO instance methods.

In following Java semantics, any static initialization code in a class
(collectively a clinit) should be run before any part of that class is used. To
achieve this, GWT ensures that this clinit was invoked before any (actually)
static method, and as part of any constructor. This way, instance methods are
sure to have already run the clinit, so it doesn't need to be run again.

However, JSO constructors don't exist, so instance methods are not guaranteed to have had the clinit already run. This is the bug that this patch is trying to
fix.

Two locations are changed, both with the effect of ensuring that a clinit is
emitted for JSOs. First, the MethodInliner must not skip adding a call to the clinit when the jso body is inlined and the method invocation (and ref to the
class) is dropped, and second, GenerateJavaScriptAST must likewise write out
explicit clinits for any static method or jso instance method.

The jso methods for the unit tests include methods that seem slightly convoluted to avoid being inlined - once inlined, the clinit would re-appear (as it shoud, since the static field is being accessed directly). Each situation being tested requires its own type, since the test app would require being restarted to empty out each static field. Note that prior to this fix, only the "instance method" case failed and returned null - the other situations are added just to ensure
that everything else is behaving as expected going forward.

Bug: issue 3192
Change-Id: If09885382bcf2d6c149cd8e48bfdd3ae527d67cb
---
M dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
M dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
M user/test/com/google/gwt/dev/jjs/test/JsoTest.java
3 files changed, 70 insertions(+), 4 deletions(-)


--
To view, visit https://gwt-review.googlesource.com/3361
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If09885382bcf2d6c149cd8e48bfdd3ae527d67cb
Gerrit-PatchSet: 2
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Colin Alworth <niloc...@gmail.com>
Gerrit-Reviewer: Colin Alworth <niloc...@gmail.com>
Gerrit-Reviewer: John A. Tamplin <j...@jaet.org>
Gerrit-Reviewer: Leeroy Jenkins <jenk...@gwtproject.org>

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to