Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop swallowing compile errors ApplicationControllerGenerator! #734

Merged
merged 2 commits into from
Oct 19, 2015

Conversation

BenDol
Copy link
Contributor

@BenDol BenDol commented Sep 19, 2015

When a type produces GWT compile errors (i.e. Java compile errors or client code errors) the TypeOracle#findType returns null on types that are affected by the compile error. Most of the time this would be the entry point classes, resulting in an ambiguous error message when producing the ApplicationController. For example when it attempts to load the Bootstrapper it returns the type as null when there are Java compile errors or GWT client specific compile errors originating from the entry-point class.

For example, this is the error I would expect to see:

[WARN] Class com.bugs.NotInClientOrSharedPackage is used in Gin, but not available in GWT client code.

But instead I would get something like this:

[ERROR] The type 'nz.co.doltech.xxx.client.Application.PreBootstrapperImpl' was not found.

This issue has bugged be for quite some time now especially when an ammeter with GWT is using GWTP so its nice to finally have it resolved!

Before:

GET /recompile/wayhome
   Job nz.co.doltech.wayhome.WayHomeDev_1_0
      starting job: nz.co.doltech.wayhome.WayHomeDev_1_0
      binding: locale=en
      Compiling module nz.co.doltech.wayhome.WayHomeDev
         Ignored 14 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
         Computing all possible rebind results for 'com.gwtplatform.mvp.client.ApplicationController'
            Rebinding com.gwtplatform.mvp.client.ApplicationController
               Invoking generator com.gwtplatform.mvp.rebind.ApplicationControllerGenerator
                  [ERROR] The type 'nz.co.doltech.wayhome.client.Application.PreApplicationImpl' was not found.
         [ERROR] Errors in 'gen/com/google/gwt/lang/nz_00046co_00046doltech_00046wayhome_00046WayHomeDev__EntryMethodHolder.java'
            [ERROR] Line 3: Failed to resolve 'com.gwtplatform.mvp.client.ApplicationController' via deferred binding
         [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
            [WARN] com.gwtplatform.mvp.client.ApplicationControllerImpl
         Unification traversed 20238 fields and methods and 1812 types. 1777 are considered part of the current module and 1777 had all of their fields and methods traversed.

After:

GET /recompile/wayhome
   Job nz.co.doltech.wayhome.WayHomeDev_1_3
      starting job: nz.co.doltech.wayhome.WayHomeDev_1_3
      binding: locale=en
      Compiling module nz.co.doltech.wayhome.WayHomeDev
         Ignored 11 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
         Computing all possible rebind results for 'com.gwtplatform.mvp.client.DesktopGinjector'
            Rebinding com.gwtplatform.mvp.client.DesktopGinjector
               Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
                  [WARN] Class sun.security.jgss.HttpCaller is used in Gin, but not available in GWT client code.
                  [ERROR] Error injecting nz.co.doltech.wayhome.client.application.activate.ActivateView$Binder: Unable to create or inherit binding: No @Inject or default constructor found for nz.co.doltech.wayhome.client.application.activate.ActivateView$Binder
  Path to required node:

When a type produces GWT compile errors (i.e. Java compile errors or non-client code errors) the TypeOracle#findType returns null on types that are affected by the compile error. Most of the time this would be the entry point classes, resulting in an ambiguous error message when producing the ApplicationController. For example when it attempts to load the Bootstrapper it returns the type as null when there are Java compile errors or GWT client specific compile errors originating from the entry-point class.

For example, this is the error I would expect to see:
[WARN] Class com.bugs.NotInClientOrSharedPackage is used in Gin, but not available in GWT client code.

But instead I would get something like this:
[ERROR] The type 'nz.co.doltech.xxx.client.Application.PreBootstrapImpl' was not found.

This issue has bugged be for quite some time now especially when an ammeter with GWT is using GWTP so its nice to finally have it resolved!
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
RootPanel.get().add(new HTML("<h3>" + REASON + "</h3>"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this h3.

@jasonlemay Maybe you can suggest / style something? This will display an error instead of the app when something went wrong during the compilation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Chris-V @BenDol I need context. Can I have a screenshot of where this is displayed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well its just an error message, the intention is that it will simply warn the user of a problem that needs to be fixed.

@Chris-V
Copy link
Member

Chris-V commented Sep 23, 2015

LGTM. Clever workaround

@Chris-V
Copy link
Member

Chris-V commented Oct 19, 2015

We can change the message any time anyways. Thanks for the contribution!

Chris-V added a commit that referenced this pull request Oct 19, 2015
Stop swallowing compile errors ApplicationControllerGenerator!
@Chris-V Chris-V merged commit e001fb5 into ArcBees:master Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants