Skip to content

[Q] {{#values}} causes StackOverflowError #1166

@DatApplePy

Description

@DatApplePy

Let's say I have a class like this:

public class CodegenMap extends CodegenType {

  private CodegenType values;

  // constructors...
  // setters & getters...

  @Override
  public boolean isMap() {
    return true;
  }
}

And we have this recursive template (property.hbs):

{{#if isArray}}{{{typeName}}}<{{#items}}{{>property}}{{/items}}>{{/if}}
{{~#if isMap}}{{{typeName}}}<{{#values}}{{>property}}{{/values}}>{{/if}}
{{~#if isModel}}{{{typeName}}}{{/if}}
{{~#if isPrimitive}}{{{typeName}}}{{/if}}

Using the log helpers I got the followings:

  • {{log values}} -> [2, false]
  • {{log this.values}} -> ...model.CodegenMap@aeab7ff3
    So as we can see, using this.values works fine.

I dug into the code a bit to figure out what Handlebars was doing with the values ​​value, but I couldn't.
Could you please explain this behavior of Handlebars to me?
Also, are there any other "keywords" that should be avoided or can only be used with "this"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions