antlr / stringtemplate4

StringTemplate 4
http://www.stringtemplate.org
Other
956 stars 231 forks source link

Legal use of conditionals should not result in runtime errors occurring. #178

Closed rbentall closed 6 years ago

rbentall commented 7 years ago

The notes on use of conditionals say "The conditional expressions test of the presence or absence of an attribute"

Given the following:

myClass { public String getMyAttribute(){ return "hello"; } }

I'd expect:

<if(myClass.myAttribute)> - should evaluate to true. <if(myClass.myMissingAttribute)> - should evaluate to false, because there is no "getMyMissingAttribute() getter on the class.

This is the behaviour I see.

However the problem is that the second example results in runTime errors being raised, flagging the absence of the attribute.

Assuming my use of the conditionals is correct, I think this is a defect - legal use of conditionals shouldn't result in runtime errors being raised.

parrt commented 6 years ago

This would have potentially far-reaching effects I'm afraid. I worry that it might change the behavior of a bunch of existing systems. sorry!