[ 
https://issues.apache.org/jira/browse/VELOCITY-984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17886924#comment-17886924
 ] 

Thomas Mortagne commented on VELOCITY-984:
------------------------------------------

Indeed, I can reproduce the error you have with the test you provided when 
building Velocity with Java 21. I think this is simply because 
AbstractStringBuilder is package protected (which is not the case of 
StringBuilder).

[~cbrisson] I feel like the logic of getTopMostMethodDeclaration should be 
modified a bit to stop at the first accessible method (so more of a 
getAccessibleMethodDeclaration) instead of always going all the way to the top, 
like I did in 
https://github.com/xwiki/xwiki-commons/blob/xwiki-commons-15.10/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/MethodOverrideUberspector.java.
 It should cover problems like this (and it means stopping earlier in most 
cases, which is probably better for performances)

> Velocity calls method of abstract superclass leading to an 
> IllegalAccessException
> ---------------------------------------------------------------------------------
>
>                 Key: VELOCITY-984
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-984
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 2.4
>            Reporter: Christoph Lenggenhager
>            Priority: Major
>         Attachments: Velocity952TestCase.java
>
>
> With the changes introduced in VELOCITY-952, our templates fail with an 
> IllegalAccessException.
> The exception is caused by a template that has a variable of type 
> StringBuilder and calls append on it. The introduced changes choose the 
> implementation of the method of AbstractStringBuilder to be executed, which 
> leads to the mentioned IllegalAccessExceptions.
> I've attached an extended version of Velocity952TestCase.java that reproduces 
> the problem with an additional test.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to