Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-1296

PlaceHistoryHandler should map places to their tokenizer in most-specific to least-specific order


    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.0.M3
    • Fix Version/s: None
    • Component/s: GWT
    • Labels:


      PlaceHistoryHandler (PlaceHistoryHandlergenerator actually) currently maps a given Place to its PlaceTokenizer, in the generated getPrefixAndToken implementation, by cascading instanceof checks in the order of the known token prefixes. This order is (fortunately) stable but not at all intuitive.
      This means you have to be very careful when you have a hierarchy of place types with some PlaceTokenizer for a base class and another for a subclass; it's currently too easy to have it wrong and/or break it.

      Therefore, I suggest the generator should do its best effort to order the instanceof checks from most-specific to least-specific types. It fortunately shouldn't be too hard, given that Place is a class (rather than an interface), though probably not trivial.

      At the very least, the order the place types are considered should be documented. For those wondering, it currently is:

      • non-final methods from the factory, in alphabetical order
      • final methods from the factory, in alphabetical order
      • value of the @WithTokenizers annotation, in the order they're specified
        this means you can break your app by simply renaming your factory's method and/or adding/removing a "final" modifier.




            • Assignee:
              rjrjr@google.com Ray Ryan
              t.broyer Thomas Broyer
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: