The attached patch fixes web-mode compilation for SingleJsoImpl JSO
types that are never explicitly referenced by user code.

Consider the case where you're only ever using interfaces in your code
and never explicitly refer to the implementing JSO type:

client/Foo.java:
  interface Foo { methods }

client/generated/JsoFoo.java:
  class JsoFoo extends JavaScriptObject implements Foo {  code }

client/EntryPoint.java:
  public native Foo getFoo() /*-{ return $wnd.foo }-*/;

JDT compiles types on a demand-basis, and since JsoFoo isn't
referenced from the entry-point, the concrete type is never actually
available in the JProgram.  The fix is to use the already-computed
SingleJsoImpl information in the web-mode TypeOracle to seed
additional types into the compilation.

This wasn't caught before since all of my test code either used inner
types, or explicitly referred to the concrete JSO type in order to
test casting behavior.  A new test is added that leaves the concrete
JSO type unreferenced.

NB: When you think the Pruner is giving you trouble, make sure JDT
actually gave you the data that you think was pruned.

Diffstat:
 dev/core/src/com/google/gwt/dev/jdt/AbstractCompiler.java
             |   58     27 +    31 -    0 !
 dev/core/src/com/google/gwt/dev/jdt/WebModeCompilerFrontEnd.java
             |   30     30 +    0 -     0 !
 user/test/com/google/gwt/dev/jjs/test/SingleJsoImplTest.java
             |    7     7 +     0 -     0 !
 user/test/com/google/gwt/dev/jjs/test/jsoimpls/UnreferencedSingleJsoType.java
     |   37     37 +    0 -     0 !
 
user/test/com/google/gwt/dev/jjs/test/jsointfs/UnreferencedSingleJsoInterface.java
|   24  24 +    0 -     0 !
 5 files changed, 125 insertions(+), 31 deletions(-)

-- 
Bob Vawter
Google Web Toolkit Team

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

Attachment: singlejsoimpl_unreferenced_types_r4851.patch
Description: Binary data

Reply via email to