[jira] [Commented] (JEXL-171) Map access operator does not work if key name clashes with map property name

2015-08-03 Thread Dmitri Blinov (JIRA)

[ 
https://issues.apache.org/jira/browse/JEXL-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14651487#comment-14651487
 ] 

Dmitri Blinov commented on JEXL-171:


Any thoughts about custom property resolvers yet?

 Map access operator does not work if key name clashes with map property name
 

 Key: JEXL-171
 URL: https://issues.apache.org/jira/browse/JEXL-171
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.0
Reporter: Dmitri Blinov
Assignee: Henri Biestro
Priority: Critical
 Fix For: 3.0


 The following example returns *false*, according to documentation should 
 return *2*.
 i = new (java.util.HashMap); i.a = 1; i[empty] = 2; i[empty] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JEXL-171) Map access operator does not work if key name clashes with map property name

2015-08-03 Thread Henri Biestro (JIRA)

[ 
https://issues.apache.org/jira/browse/JEXL-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14651504#comment-14651504
 ] 

Henri Biestro commented on JEXL-171:


No thoughts (besides hacking/deriving Uberspect);
If you have a use case not covered by the current resolvers, you may want to 
create a new ticket.

 Map access operator does not work if key name clashes with map property name
 

 Key: JEXL-171
 URL: https://issues.apache.org/jira/browse/JEXL-171
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.0
Reporter: Dmitri Blinov
Assignee: Henri Biestro
Priority: Critical
 Fix For: 3.0


 The following example returns *false*, according to documentation should 
 return *2*.
 i = new (java.util.HashMap); i.a = 1; i[empty] = 2; i[empty] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JEXL-171) Map access operator does not work if key name clashes with map property name

2015-07-31 Thread Henri Biestro (JIRA)

[ 
https://issues.apache.org/jira/browse/JEXL-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14649468#comment-14649468
 ] 

Henri Biestro commented on JEXL-171:


They hardcode the previous/default behavior.
You should override them if you need to call these methods directly.
The script  template engines won't call them.

I'm not really satisfied with this current solution though...

 Map access operator does not work if key name clashes with map property name
 

 Key: JEXL-171
 URL: https://issues.apache.org/jira/browse/JEXL-171
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.0
Reporter: Dmitri Blinov
Assignee: Henri Biestro
Priority: Critical
 Fix For: 3.0


 The following example returns *false*, according to documentation should 
 return *2*.
 i = new (java.util.HashMap); i.a = 1; i[empty] = 2; i[empty] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JEXL-171) Map access operator does not work if key name clashes with map property name

2015-07-31 Thread Dmitri Blinov (JIRA)

[ 
https://issues.apache.org/jira/browse/JEXL-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14649307#comment-14649307
 ] 

Dmitri Blinov commented on JEXL-171:


I wonder why the following two methods in Uberspect.java are hardcoded to POJO 
and do not use new getStrategy() method?

{code}
@Override
public JexlPropertyGet getPropertyGet(Object obj, Object identifier) {
return getPropertyGet(POJO, obj, identifier);
}

@Override
public JexlPropertySet getPropertySet(final Object obj, final Object 
identifier, final Object arg) {
return getPropertySet(POJO, obj, identifier, arg);
}

{code}

Should I override them also with getStrategy() ?

 Map access operator does not work if key name clashes with map property name
 

 Key: JEXL-171
 URL: https://issues.apache.org/jira/browse/JEXL-171
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.0
Reporter: Dmitri Blinov
Assignee: Henri Biestro
Priority: Critical
 Fix For: 3.0


 The following example returns *false*, according to documentation should 
 return *2*.
 i = new (java.util.HashMap); i.a = 1; i[empty] = 2; i[empty] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JEXL-171) Map access operator does not work if key name clashes with map property name

2015-07-31 Thread Dmitri Blinov (JIRA)

[ 
https://issues.apache.org/jira/browse/JEXL-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14648816#comment-14648816
 ] 

Dmitri Blinov commented on JEXL-171:


Oops, I have just bumped into a problem when accessing a Map property via '.' 
still returns a property of the object implementing a Map and not a key-value 
from Map. I'm using custom Uberspect implementation which overrides the default 
one with the follwing code:

{code}
   protected final ListResolverType resolvingOrder = Arrays.asList(
JexlUberspect.ResolverType.MAP, 
JexlUberspect.ResolverType.LIST, 
JexlUberspect.ResolverType.CONTAINER,
JexlUberspect.ResolverType.PROPERTY, 
JexlUberspect.ResolverType.DUCK);
   }

   @Override
   public JexlPropertyGet getPropertyGet(Object obj, Object identifier) {
   return getPropertyGet(resolvingOrder, obj, identifier);
   }

   @Override
   public JexlPropertySet getPropertySet(final Object obj, final Object 
identifier, final Object arg) {
   return getPropertySet(resolvingOrder, obj, identifier, arg);
   }
{code}

but that code just seems not to be used. After peeping into Interpeter.java I 
have found that indeed the strategy for accessing methods is not taken from 
Uberspect but is constructed on the fly:
{code}
ListJexlUberspect.ResolverType strategy = (node == null) || 
!(node.jjtGetParent()instanceof ASTArrayAccess) ? JexlUberspect.POJO : 
JexlUberspect.MAP;
JexlPropertyGet vg = uberspect.getPropertyGet(strategy, object, 
attribute);
{code}

I think it's a bad idea to break a rule of thumb that *a.b* should be equal to 
*a\[b\]*. If one wants to change the order for property resolution globally 
the custom Uberspect implementation is right and sufficient way to do so, and 
combined with annotations for particular objects we can provide virtually any 
desired flexibility

 Map access operator does not work if key name clashes with map property name
 

 Key: JEXL-171
 URL: https://issues.apache.org/jira/browse/JEXL-171
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.0
Reporter: Dmitri Blinov
Assignee: Henri Biestro
Priority: Critical
 Fix For: 3.0


 The following example returns *false*, according to documentation should 
 return *2*.
 i = new (java.util.HashMap); i.a = 1; i[empty] = 2; i[empty] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JEXL-171) Map access operator does not work if key name clashes with map property name

2015-07-31 Thread Dmitri Blinov (JIRA)

[ 
https://issues.apache.org/jira/browse/JEXL-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14648938#comment-14648938
 ] 

Dmitri Blinov commented on JEXL-171:


Should we also consider adding some type of custom property resolvers ?

 Map access operator does not work if key name clashes with map property name
 

 Key: JEXL-171
 URL: https://issues.apache.org/jira/browse/JEXL-171
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.0
Reporter: Dmitri Blinov
Assignee: Henri Biestro
Priority: Critical
 Fix For: 3.0


 The following example returns *false*, according to documentation should 
 return *2*.
 i = new (java.util.HashMap); i.a = 1; i[empty] = 2; i[empty] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JEXL-171) Map access operator does not work if key name clashes with map property name

2015-07-30 Thread Dmitri Blinov (JIRA)

[ 
https://issues.apache.org/jira/browse/JEXL-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14648765#comment-14648765
 ] 

Dmitri Blinov commented on JEXL-171:


Great, can we have also an annotation for this to be able to specify property 
resolution order for a particular class ?

Something like this...
{code}
@JexlProperty({JexlUberspect.ResolverType.MAP, JexlUberspect.ResolverType.LIST})
public class Foo {
{code}

 Map access operator does not work if key name clashes with map property name
 

 Key: JEXL-171
 URL: https://issues.apache.org/jira/browse/JEXL-171
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.0
Reporter: Dmitri Blinov
Assignee: Henri Biestro
Priority: Critical
 Fix For: 3.0


 The following example returns *false*, according to documentation should 
 return *2*.
 i = new (java.util.HashMap); i.a = 1; i[empty] = 2; i[empty] 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)