Bug 4582 - Property default value expression may not contain default value expression
Property default value expression may not contain default value expression
Status: RESOLVED FIXED
Product: jbatch
Classification: Unclassified
Component: source
1
PC Mac OS
: P5 minor
: ---
Assigned To: cvignola
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-23 02:57 UTC by cf126330
Modified: 2013-01-26 20:05 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cf126330 2013-01-23 02:57:13 UTC
The default value of a property can be another value expression, which theoretically may contain its own default value expression.  But I don't think that's common use, and would like to propose to disallow the default value expressing having its own default.  

For example, the following expression would be considered illegal:

"#{systemProperties['foo']}?:#{systemProperties['bar']}?:1.0;"

If the spec does want to support this structure, it should explicitly state so.
Comment 1 cvignola 2013-01-24 00:08:12 UTC
Ok, that was not the intent. One attribute value should have one default. I rewrote the syntax to make that true:

<attribute-value> ::= ' " ' <value-expression> [ "?:" <value-expression> ";"] ' " '

<value-expression> ::= "#{"<operator-expression>"}" | <string-literal> [ <value-expression> ]
Comment 2 kmukher 2013-01-26 20:05:53 UTC
The intent of the previous grammar in the spec was to associate each default value expression with one operator expression. This way it is unambiguous as to which part of a value expression did not resolve if there are multiple operator expressions or literals. If we have one default value for an entire attribute we have to create a more complex definition of what unresolved means and it restricts the number of operator expressions that can effectively be used within an attribute.

I agree that we probably shouldn't allow recursive substitutions. The grammar below should achieve the effect of not allowing recursive default substitution expressions while still keeping the grammar unambiguous. We just need to introduce a new symbol "default-value-expression" that does not allow substitutions within itself.

<attribute-value> ::= ' " ' <value-expression> ' " '

<default-value-expression> ::= "#{"<operator-expression>"}" | <string-literal> [ <default-value-expression> ]

<value-expression> ::= "#{"<operator-expression>"}" [ "?:" <default-value-expression> ";"] | <string-literal> [ <value-expression> ]