jsr341-experts@el-spec.java.net

[jsr341-experts] Re: Static field syntax

From: Pete Muir <pmuir_at_redhat.com>
Date: Fri, 5 Aug 2011 10:37:24 +0100

Syntax seems simple, and feels consistent with the rest of EL. So, as Mark said, as long as this doesn't break compatibility, I think this is a good approach.

On 5 Aug 2011, at 06:01, Ramesh wrote:

> Not sure if accessing the static fields is required.
> But if it is required, this syntax sound good.
>
> On 8/5/2011 4:42 AM, Kin-man Chung wrote:
>> One of the proposed features for this JSR is the inclusion of static fields in EL expressions. The Java syntax for static fields (e.g. "a.b.MyClass.field") is in direct conflict with the EL dot ('.') operator and using that syntax in EL would introduce an ambiguity at parse time. It has been suggested before that we keep the ambiguity at parse time, and use an ELResolver to resolve it run evaluation time.
>>
>> Instead of pursuing such idea, I'd like to use another idea from Spring EL, which uses the notation T() to denote a type. So to reference a static field one would write, for instance,
>>
>> #{"T(java.lang.System).out"}
>>
>> Spring EL also use T() to specify an instance of Class, but I think it overloads its meaning unnecessarily, when one can use T().class to do the same thing. But this is just an aside.
>>
>> I think this is a very good compromise. It is simpler to implement and should lead to better performance.
>>
>> Please tell me what you think, before I go and work out all the details in the spec. :-) Thanks.
>>
>> Kin-man
>>