You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "William R. Zwicky (JIRA)" <de...@velocity.apache.org> on 2010/09/02 11:21:53 UTC

[jira] Commented: (VELOCITY-761) Can not reference a property declared in a super-interface and implemented in a non-public class

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

William R. Zwicky commented on VELOCITY-761:
--------------------------------------------

You're missing the point, the problem is one of consistency.  The methods we (myself and the original poster) are trying to access are public, but Velocity is getting confused over the status of the class itself.  Java doesn't have this problem; if a class is not accessible, then NO part of it can be read.  If the class is accessible, then ALL public parts can be read.

Velocity is different:  If the class is not public, then it is PARTIALLY accessible.

I believe this needs to be brought into sync with Java (forbid all access to non-public classes) or brought into sync with common sense (allow access to all public methods, regardless of the visibility of the class.)


> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org