Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Java 16 records in property lookup #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jtotht
Copy link

@jtotht jtotht commented Apr 14, 2024

Java 16 records (JEP 395) are a perfect fit for Velocity variables: they are lightweight and desgined to contain immutable data. However, records don’t follow the JavaBean convention: the getter of the field foo is foo(), not getFoo(). Add support for this naming convention.

While this naming convention is mostly useful in projects using Java 16 records, the patch itself doesn’t rely on records, so it doesn’t break Java 1.8 compatibility.

Java 16 records (JEP 395) are a perfect fit for Velocity variables: they
are lightweight and desgined to contain immutable data. However, records
don’t follow the JavaBean convention: the getter of the field `foo` is
`foo()`, not `getFoo()`. Add support for this naming convention.

While this naming convention is mostly useful in projects using Java 16
records, the patch itself doesn’t rely on records, so it doesn’t break
Java 1.8 compatibility.
@michael-o
Copy link
Member

Stupid question: is this limited to records only or will it work with any method without get prefix?

@jtotht
Copy link
Author

jtotht commented Apr 14, 2024

Actually, I could only test it with regular classes because of the project’s Java 1.8 support. So other methods work definitely, records work hopefully. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants