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

Endless recursion: GWT compiler hangs instead of producing an error message #9647

Open
Anthrac opened this issue Jan 10, 2019 · 0 comments
Open

Comments

@Anthrac
Copy link

Anthrac commented Jan 10, 2019

GWT version: 2.8.2
Browser (with version): doesn't matter
Operating System: Mac OS X (probably others as well) with Eclipse


Description

If there is an endless recursion in the program, then it can happen the GWT compiler hangs directly after "Compiling permutation 0..." (no more messages, even if all messages are enabled). Instead of this the compiler should write an error message or at least compile the code (in the latter case there would be a well defined stack overflow when testing the code).

In Eclipse there is no java error because the program is syntactically correct.

In dev mode the program runs, and as long as the endless recursion is not called you don't see the error.

When compiling, the compiler just hangs, and in big and complex projects it can be very difficult to isolate the error (in my case it took me nearly three days).

Steps to reproduce

The following code (just replacing the entry point module in the default greetings application) does the thing:

public class EndlessRecursion implements EntryPoint {

  public String stupid(int x) {
    return stupid(x);
  }
  
  public void onModuleLoad() {
    String q = "text";
    String issue = String.valueOf(Math.random());
    if ("999".equals(issue)) {
      q = stupid(0);
    }
    RootPanel.get("nameFieldContainer").add(new HTML(q));
  }
}

The method stupid() is obviously nonsense. If you have different method signatures and you add an parameter it can happen this is not so obvious.

The java compiler doesn't report an error. The GWT compiler hangs.

Known workarounds

The problem is to isolate the error. The only way I found doing so is to put parts of the code into comments, start the compiler again and see if it still hangs. (If there are many classes this can be time consuming, and you need really many tries, and the code optimizations done by the GWT compiler can lead you on a wrong track.)

Once the error found it is easy to correct it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants