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

Ability to specify end tag to avoid automatic incorrect/undesired inference #103

Open
243826 opened this issue Mar 9, 2019 · 1 comment

Comments

@243826
Copy link

243826 commented Mar 9, 2019

Consider the following rocker snippet simplified to exemplify the problem:

@for((i, prop): props) {
@with(String hasher = "Arrays") {
   @hasher.hashCode(@prop.get("key"))
}
}

I wrote that with the intent to create the following output for each prop:

Arrays.hashCode(value)

It seems that the generated code would not compile because the .hashCode after @hasher is inferred to be a hashCode method invocation on java object hasher. How do I express my intent?

The following variations work but they come with undesired side effects.
@hasher. hashCode(@prop.get("key")) produces Arrays .hashCode(value) but of course with the extra space.

{@hasher}.hashCode(@prop.get("key")) produces {Arrays}.hashCode(value) with extra curly braces.

Need an elegant way out without having to do major overhaul.

@243826 243826 changed the title Ability to specify end tag to avoid automatic incorrect inference Ability to specify end tag to avoid automatic incorrect/undesired inference Mar 9, 2019
@jjlauer
Copy link
Member

jjlauer commented Mar 9, 2019 via email

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

No branches or pull requests

2 participants