I am using ST-4.0.7.jar and my template looks like this:
backtrack_result(btresult) ::=<<
<backtrack-result>
<pattern id="$btresult.pattern.id$">$btresult.pattern.description$</pattern>
<file>$btresult.file.file.path$</file>
<line>$btresult.codeline.lineNr$</line>
<method>$btresult.codeline.method.name$</method>
</backtrack-result>
>>
However when I look into my output file I just get
<method></method>
In BTResult:
public CodeLineInterface getCodeline() {
return cl;
}
In CodeLine:
public MethodInterface getMethod() {
return method;
}
In Method:
public String getName() {
return name;
}
I set a breakpoint in the codeline object for the getMethod Method and it is never called. So I conclude that somehow stringtemplate has a problem resolving the correct getter.
I added an STErrorListener an found that ST throws the following error:
STReportGenerator - context [/report /backtrack_results /backtrack_result] 5:19 no such property or can't access: ju.no.need.toknow.BTResult.method
Caused by: org.stringtemplate.v4.misc.STNoSuchPropertyException: no such property: ju.no.need.toknow.BTResult.method
at org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java:106)
at org.stringtemplate.v4.misc.ObjectModelAdaptor.lookupMethod(ObjectModelAdaptor.java:99)
at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:67)
at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1158)
What especially puzzles me about this: Why does it try to resolve to BTReult.method when the template says it should get btresult.codeline.method.name?
OK. It was my own stupidity: while I did fix my template the code actually used an old template so it appeared to me that all my fixes did not work. OSI Layer 8 Problem ;-)