You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Adrian (Jira)" <ji...@apache.org> on 2026/09/09 05:04:00 UTC
[jira] [Created] (FREEMARKER-235) ZeroArgumentNonVoidMethodPolicy.BOTH_METHOD_AND_PROPERTY_UNLESS_BEAN_PROPERTY_READ_METHOD not handling overloads correctly
Adrian created FREEMARKER-235:
---------------------------------
Summary: ZeroArgumentNonVoidMethodPolicy.BOTH_METHOD_AND_PROPERTY_UNLESS_BEAN_PROPERTY_READ_METHOD not handling overloads correctly
Key: FREEMARKER-235
URL: https://issues.apache.org/jira/browse/FREEMARKER-235
Project: Apache Freemarker
Issue Type: Bug
Components: engine
Affects Versions: 2.3.34
Reporter: Adrian
Hi,
I tried the somewhat new ZeroArgumentNonVoidMethodPolicy feature.
Unfortunately, it seems to completely break on method overloads.
For easy reproduction, I modified the TestZeroArgument..., adding these methods to the TestDefault class:
{code:java}
public int overloaded() {
return 1;
}
public int overloaded(int n) {
return n;
}
{code}
and extending assertNrcIsBothPropertyAndMethod():
{code:java}
//assertOutput(modifyTemplate("${nrc.overloaded}", tempMods), "1");
//assertOutput(modifyTemplate("${nrc.overloaded()}", tempMods), "1");
assertOutput(modifyTemplate("${nrc.overloaded(3)}", tempMods), "3");
{code}
Only the not-commented line runs. Both other assertions fail:
The zero-argument method becomes completely uncallable.
I tried to fix it myself, but am not familiar with the code, and the issue seems non-trivial.
Right now, the ClassIntrospector seems to handle the policy completely at introspection time. The single-argument overload then seems to override the previously added property descriptor. But I'm unsure on how to make both work at the same time.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)