ravimergu1 opened a new pull request, #59:
URL: https://github.com/apache/velocity-engine/pull/59

   **Problem:**
   
   After adding a new feature to support Java 16 record-style properties (see 
this PR: https://github.com/apache/velocity-engine/pull/45), we are seeing an 
issue when using a Map that has keys with the same names as method names.
   
   Here is an example:
   
   ```
   Map<String, Object> map = new HashMap<>();
   List<Integer> list = new ArrayList<>();
   list.add(1);
   map.put("values", list);
   map.put("size", "6Feet");
   ```
   
   In this example:
   
   1.  When we try to get values, we expect to get the list [1], but instead we 
get all values from the map. This happens because it's calling the map.values() 
method, not the "values" key.
   2.  When we try to get size, we expect to get "6Feet", but we get 2 instead, 
because it's calling the map.size() method.
   
   **Reported issues:** 
   
   Issue1: [VELOCITY-986](https://issues.apache.org/jira/browse/VELOCITY-986)
   Issue2: 
https://github.com/apache/velocity-engine/pull/45#discussion_r2225914086
   
   **Solution:**
   
   To fix this, we should skip or ignore Map objects when using the Java 16 
record-style property feature. That way, it will get the actual values from the 
map keys, not from the methods.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to