Skip to content

Router fails to add second route using method reference after upgrading to GWT 2.12.2 #231

@jamalromero

Description

@jamalromero

I am not sure if this is an issue with Router code base or with GWT latest upgrade version 2.12.2. Here's a snippet of code that works with the previous version GWT 2.12.1

  public void onModuleLoad() {
       body().add(div().id("main"));
       Places allPlaces = places()
               .add(place("/"), IndexPage::new)
               .add(place("/login"), LoginPage::new); // <-- This work fine as expected. But doesn't with GWT latest 2.12.2

       PlaceManager placeManager = new PlaceManager()
               .root(By.id("main"))
               .register(allPlaces);
       placeManager.start();
   }

IndexPage.java and LoginPage.java have nothing special. They produce a simple Iterable<HTMLElement> just like the examples provided in the Javadoc api for the PlaceManger class.
Upgrading to GWT 2.12.2, IndexPage shows up as expected, however LoginPage is not even included in the browser's sourcemaps, clicking on a link to move to LoginPage produces an error on the browser indicating the absence of LoginPage reference .
While keeping the same latest GWT version 2.12.2, and I changed the creation of LoginPage using lambda expression, it works! Example:

  public void onModuleLoad() {
       body().add(div().id("main"));
       Places allPlaces = places()
               .add(place("/"), IndexPage::new)
               .add(place("/login"), () -> new LoginPage()); // <--- This works!!! Even with GWT latest 2.12.2

       PlaceManager placeManager = new PlaceManager()
               .root(By.id("main"))
               .register(allPlaces);
       placeManager.start();
   }

So the problem happens only when upgrading to GWT latest version 2.12.2, it's all fine with GWT 2.12.1 using just method references as in LoginPage::new

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions