Re: [PR] Support Java 16 records in property lookup [veloc ity-engine]

ravimergu1 (via GitHub) <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.devel
Message-ID <PR_kwDOAN72MM5smNlV-f329d493-3073-4c23-b330-099085ef77ac@gitbox.apache.org>
ravimergu1 commented on code in PR #45:
URL: https://github.com/apache/velocity-engine/pull/45#discussion_r2226376668


##########
velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java:
##########
@@ -119,6 +119,16 @@ protected void discover(final Class<?> clazz, final String property)
 
                 setMethod(introspector.getMethod(clazz, sb.toString(), params));
             }
+
+            if (!isAlive())
+            {
+                /*
+                 * If no JavaBean property was found, try the convention used by Java 16 records.
+                 * No convenience case flip because the more convenient lowerCamelCase is also the
+                 * more likely to be used in the record itself.
+                 */
+                setMethod(introspector.getMethod(clazz, property, params));
+            }

Review Comment:
   This issue is similar to [VELOCITY-986](https://issues.apache.org/jira/browse/VELOCITY-986). In this case, we are calling the values method on a map object. The values method returns a collection, and within that collection, there is a single element which is an array. This is why we are seeing a nested array (an array within an array) in the output.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.