markt-2 wrote:
> 
> On 27/09/2010 02:23, sbrejeon wrote:
>> A.test==B.test throws the exception. couldn't it just return false?
> 
> Such a change would put Tomcat's EL implementation in breach of the EL
> spec so this behaviour will not be changed.
> 
> Mark
> 

Thank you for your quick reply.

The spec says that "If A or B is an enum, coerce both A and B to enum, apply
operator".
Does't it simply mean that both A and B must be coercible to enums. instead
of if A is an enum then B must be an enum of type A, or vice versa.

in the coerceToEnum method I would return the object if it is an enum
(whatever its type is):

public final static Enum<?> coerceToEnum(final Object obj, Class type) {
    if (obj == null || "".equals(obj)) {
        return null;
    }

    if(obj.getClass().isEnum()){
         return (Enum<?>)obj;
    }
...
}

Like the original creator of this post, I have a series of enums of
different types that implement a common interface. I need to be able to
compare them and I don't want to have to translate them to Strings.

Regards
Sbrejeon


-- 
View this message in context: 
http://old.nabble.com/Strange-difference-in-behavior-ELSupport-in-Tomcat-6.0.20-and-Tomcat--6.0.26-tp29088066p29815521.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to