[
https://issues.apache.org/jira/browse/SLING-10682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Norman resolved SLING-10682.
---------------------------------
Resolution: Fixed
Merged PR at:
[{{5c9454d}}|https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler/commit/5c9454d55f71e96534f1d137bc115912a51c9523]
> Comparison operators don't work to compare enum to another enum
> ---------------------------------------------------------------
>
> Key: SLING-10682
> URL: https://issues.apache.org/jira/browse/SLING-10682
> Project: Sling
> Issue Type: Improvement
> Reporter: Eric Norman
> Assignee: Eric Norman
> Priority: Minor
> Fix For: Scripting HTL Compiler 1.2.14-1.4.0
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> An expression that attempts to compare an enum to another enum throws a
> SightlyCompilerException exception with a message stating that the operands
> are not of same type.
> {noformat}
> Caused by:
> org.apache.sling.scripting.sightly.compiler.SightlyCompilerException:
> Operands are not of the same type: the equality operator can only be applied
> to String, Number and Boolean types.
> at
> org.apache.sling.scripting.sightly.compiler.expression.nodes.BinaryOperator.strictEq(BinaryOperator.java:247)
> [org.apache.sling.scripting.sightly.compiler:1.2.12.140]
> at
> org.apache.sling.scripting.sightly.libs.sling.servlet.__0064__efault.acl_body__002e__html.render(acl_body__002e__html.java:57)
> at
> org.apache.sling.scripting.sightly.render.RenderUnit.render(RenderUnit.java:53)
> [org.apache.sling.scripting.sightly.runtime:1.2.5.140-SNAPSHOT]
> at
> org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:61)
> [org.apache.sling.scripting.sightly:1.4.9.140-SNAPSHOT]
> at
> org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386)
> [org.apache.sling.scripting.core:2.3.6]
> at
> org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)
> [org.apache.sling.scripting.core:2.3.6]
> at
> org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491)
> [org.apache.sling.scripting.core:2.3.6]
> ... 92 common frames omitted
> {noformat}
> Expected:
> Comparing two enum objects should work without throwing any exception.
> For example:
> {code:html}
> enum equals enum = ${myEnum.ONE == myEnum.ONE}
> enum notEquals enum = ${myEnum.ONE != myEnum.TWO}
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)