[
https://issues.apache.org/jira/browse/VELOCITY-761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893880#action_12893880
]
Christopher Schultz commented on VELOCITY-761:
----------------------------------------------
William,
Which "get" method are you trying to call? There are two:
public String get(String key) // defined in package-protected class MapList
public Object get(int index) // defined in public interface java.util.List
I think you probably can't access your get(String) method, since it's not
actually visible publicly. This seems perfectly reasonable to me, since the
list of accessible methods should be:
* all public methods from public interfaces
+
* all public methods from public classes
You'll just have to modify your class structure or visibility in order to make
this method callable from Velocity.
> Can not reference a property declared in a super-interface and implemented in
> a non-public class
> ------------------------------------------------------------------------------------------------
>
> Key: VELOCITY-761
> URL: https://issues.apache.org/jira/browse/VELOCITY-761
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.6.3
> Reporter: Charles Miller
>
> Consider the following:
> public interface MyUser extends java.security.Principal {
> String getEmailAddress();
> }
> class MyUserImpl implements MyUser {
> public String getName() { ... }
> public String getEmailAddress() { ... }
> }
> If I put a MyUserImpl in my Velocity context, $user.emailAddress will
> resolve, but $user.name will not.
> This is a problem with ClassMap#createMethodCache(). It ignores methods
> declared on the MyUserImpl class because the class is non-public, and it only
> looks up one level in the Interface hierarchy for methods defined on
> interfaces: so it will go up as far as the MyUser interface but not as far as
> the Principal interface.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]