[ 
https://issues.apache.org/jira/browse/JEXL-443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri Biestro updated JEXL-443:
-------------------------------
    Assignee: Henri Biestro

> ObjectContext can't find fields with jexl3 >= 3.3
> -------------------------------------------------
>
>                 Key: JEXL-443
>                 URL: https://issues.apache.org/jira/browse/JEXL-443
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.3, 3.4.0, 3.5.0
>         Environment: Linux / JDK 21
> Windows / JDK 17
>            Reporter: Andriy Rysin
>            Assignee: Henri Biestro
>            Priority: Major
>
> I'm creating simple ObjectContext and with jexl3 >= 3.3 I am getting 
> "variable 'param1' is undefined". This example works on jexl3 3.2.1.
> Surprisingly neither version can find "param0" even though getParam0() works.
>  
> {code:java}
> public class JexlTest {
>     @Test
>     public void testJexlFields() throws Exception {
>         JexlEngine jexl = new JexlBuilder()
>                 .cache(0)
>                 .strict(true)
>                 .silent(false)
>                 .create();
>         
>         Parameters object = new Parameters();
>         object.setParam1(Enum1.VALUE1);
>         JexlContext context = new ObjectContext<>(jexl, object);
>         jexl.createExpression("param1").evaluate(context);
> //        jexl.createExpression("param0").evaluate(context);
>         jexl.createExpression("getParam0()").evaluate(context);
>     }
>     
>     public static class Parameters {
>         private String param0;
>         private Enum1 param1;
>         
>         public String getParam0() {
>             return param0;
>         }
>         public void setParam0(String param0) {
>             this.param0 = param0;
>         }
>         public Enum1 getParam1() {
>             return param1;
>         }
>         public void setParam1(Enum1 param1) {
>             this.param1 = param1;
>         }
>         
>     }
>     public enum Enum1 {
>         VALUE1
>     }
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to