Bug 8284 - The "empty" operator is confused with a property named "empty"
Summary: The "empty" operator is confused with a property named "empty"
Status: CLOSED INVALID
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: All All
: P3 blocker (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-18 22:52 UTC by Hans Bergsten
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Bergsten 2002-04-18 22:52:05 UTC
Build: 4/18, nightly

An expression like ${!cart.empty} results in:

tag = 'if' / attribute = 'test': An error occurred while parsing custom action
attribute "test" with value "${!cart.empty}": Encountered "empty", expected one
of []

where "empty" is a property of "cart", implemented by a 

  public boolean isEmpty()

method.

If I'm interpreting the precedence rules right, this should work fine because
the "." operator has higher precedence than the "empty" operator.
Comment 1 Shawn Bayern 2002-04-18 22:55:30 UTC
No, I'm pretty sure this is a misinterpretation.  "empty" is now an identifier, 
meaning you can't use it as an identifier any more than you can 
use "null", "and", or "not."  The precedence rules don't apply because you're 
not attempting to use it as an operator.

I had mentioned this in the email that suggested the use of "empty' initially; 
my understanding of our future plan is that we will eventually map it through 
the boolean "empty" bean property, thus allowing the expression you've written 
to be replaced with ${!empty cart} in all cases.  Either way, though, you can't 
use any reserved word as an identifier.
Comment 2 Shawn Bayern 2002-04-18 22:57:04 UTC
Meant "empty is now a reserved word" at the beginning of my last addition.
Comment 3 Hans Bergsten 2002-04-18 23:10:07 UTC
Bummer, but I guess you're right ;-)