[ https://issues.apache.org/jira/browse/FREEMARKER-89?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16368333#comment-16368333 ]
Shawn Dempsay commented on FREEMARKER-89: ----------------------------------------- Yea, when I found the MethodAppearanceFineTuner I was able to resolve my issue. Hopefully if someone else runs across this they can find this solution as well. > Template rendering gets confused with static functinos > ------------------------------------------------------ > > Key: FREEMARKER-89 > URL: https://issues.apache.org/jira/browse/FREEMARKER-89 > Project: Apache Freemarker > Issue Type: Bug > Components: engine > Affects Versions: 2.3.23, 2.3.27-incubating > Reporter: Shawn Dempsay > Priority: Major > > I have an immutable class that shares naming for a field and a static getter: > package org.dempsay.demo.freemaker.api; > > > {code:java} > public class Sample { > public final String data; > protected Sample(final SampleBuilder builder) { > this.data = builder.data; > } > public static String data(final Sample sample) { > return sample.data; > } > } > {code} > > When I render it with the following template: > {code:java} > The data from this sample is ${sample.data} > {code} > I get this error: > Feb 17, 2018 7:59:40 AM freemarker.log._JULLoggerFactory$JULLogger error > SEVERE: Error executing FreeMarker template > FreeMarker template error: > For "${...}" content: Expected a string or something automatically > convertible to string (number, date or boolean), or "template output" , but > this has evaluated to a method+sequence (wrapper: f.e.b.SimpleMethodModel): > ==> sample.data [in template "sample.ftl" at line 1, column 32] > > ---- > Tip: Maybe using obj.something(params) instead of obj.something will yield > the desired value > ---- > > ---- > FTL stack trace ("~" means nesting-related): > - Failed at: ${sample.data} [in template "sample.ftl" at line 1, column 30] > ---- > > The full code for this is posted in github at: > https://github.com/sdempsay/freemarker-bug > -- This message was sent by Atlassian JIRA (v7.6.3#76005)