Description
Suppose this example:
<testComposite:compositeRefVE value="success">
</testComposite:compositeRefVE>
compositeRefVE.xhtml
<composite:interface>
<composite:attribute name="value"/>
</composite:interface>
<composite:implementation>
<testComposite:compositeRefVE2>
<p>Some text: <h:outputText value="#
</testComposite:compositeRefVE2>
</composite:implementation>
compositeRefVE2.xhtml
<composite:interface>
</composite:interface>
<composite:implementation>
<composite:insertChildren/>
</composite:implementation>
It works, everything is ok in this case. The final output is "Some text: success there.". But now change compositeRefVE.xhtml to this:
<composite:interface>
<composite:attribute name="value"/>
</composite:interface>
<composite:implementation>
<testComposite:compositeRefVE2>
<p>Some text: #{cc.attrs.value}
there.</p>
</testComposite:compositeRefVE2>
</composite:implementation>
It should do the same, but it does not work, because #
{cc.attrs.value}is resolved to null. Why? There are two reasons:
1. When the markup is executed, the current component on the stack is the inner one (compositeRefVE2), and it should be the outer one. This means the inner component must be pop and push. We didn't notice the effect in the other case, because Location object is used there to detect the current composite component.
2. If #
{cc}is used, the expression should be wrapped using LocationValueExpression, like on TagAttributeImpl
Additionally, I saw we are not caching inline EL expressions, so this is a good oportunity to do it.