You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Thomas Mortagne (Jira)" <ji...@apache.org> on 2024/09/30 08:22:00 UTC

[jira] [Created] (VELOCITY-983) Velocity calles the wrong static overwritten method

Thomas Mortagne created VELOCITY-983:
----------------------------------------

             Summary: Velocity calles the wrong static overwritten method
                 Key: VELOCITY-983
                 URL: https://issues.apache.org/jira/browse/VELOCITY-983
             Project: Velocity
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.4
            Reporter: Thomas Mortagne


Unfortunately, in my proposal in VELOCITY-952 I totally missed one use case which is now broken: a static method being "overwritten". Since Velocity 2.4, the deepest static method will be called instead of the one in the object we actually manipulate and unfortunately since static overrides are not real overrides it means it's going to call the wrong one.

The reason [the uberspector I was using with Velocity 2.3|https://github.com/xwiki/xwiki-commons/blob/a21846242821db564378bb68b1060fa42c632d16/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/MethodOverrideUberspector.java#L116] was not impacted is because I had an optimization to stop searching when hitting the first accessible method (since my focus was IllegalAccessException problems).



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

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