[
https://issues.apache.org/jira/browse/FREEMARKER-183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17806567#comment-17806567
]
Dániel Dékány edited comment on FREEMARKER-183 at 1/14/24 11:19 PM:
--------------------------------------------------------------------
Unfortunately, it's too a backward incompatible change to be enabled by
default. Also there's many other things that become better with
{{incompatible_improvements}}, so people should set it regardless. I know most
don't... but there's just no way around it.
As a side note,
{{spring.freemarker.settings.objectWrapper=DefaultObjectWrapper(2.3.33)}}
should be enough, in case someone doesn't want all the other slightly
incompatible improvements, only those in {{DefaultObjectWrapper}}. Or it can be
even more focused. Let's say someone used {{incompatible_improvements}} 2.3.29
so far, then to only enable this feature they can use
{{spring.freemarker.settings.objectWrapper=DefaultObjectWrapper(2.3.29,
nonRecordZeroArgumentNonVoidMethodPolicy=freemarker.ext.beans.ZeroArgumentNonVoidMethodPolicy.BOTH_PROPERTY_AND_METHOD)}}.
I haven't tried these BTW, but I see no reason for them not to work.
Also, I have just force-pushed some internal reworkings into the FREEMARKER-183
branch. I guess it's close to final... unless I will spot some conceptual
mistakes. Or somebody else does.
was (Author: ddekany):
Unfortunately, it's too a backward incompatible change to be enabled by
default. Also there's many other things that become better with
{{incompatible_improvements}}, so people should set it regardless. I know most
don't... but there's just no way around it.
As a side note,
{{spring.freemarker.settings.objectWrapper=DefaultObjectWrapper(2.3.33)}}
should be enough, in case someone doesn't want all the other slightly
incompatible improvements, only those in {{DefaultObjectWrapper}}. Or it can be
even more focused. Let's say someone used {{incompatible_improvements}} 2.3.29
so far, then to only enable this feature they can use
{{spring.freemarker.settings.objectWrapper=DefaultObjectWrapper(2.3.29,
nonRecordZeroArgumentNonVoidMethodPolicy=freemarker.ext.beans.ZeroArgumentNonVoidMethodPolicy.BOTH_PROPERTY_AND_METHOD)}}.
I haven't tried these BTW, but I see no reason for them not to work.
Also, I have just force-pushed some internal reworkings into the FREEMARKER-182
branch. I guess it's close to final... unless I will spot some conceptual
mistakes. Or somebody else does.
> Add support for Java records
> ----------------------------
>
> Key: FREEMARKER-183
> URL: https://issues.apache.org/jira/browse/FREEMARKER-183
> Project: Apache Freemarker
> Issue Type: Task
> Reporter: Dániel Dékány
> Assignee: Dániel Dékány
> Priority: Major
>
> Currently we don't support records (JEP 395), which was finalized in Java 16.
> Users can extend {{DefaultObjectWrapper}} for that of course, but it should
> be supported out of the box.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)