freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FREEMARKER-40) ClassIntrospector should detect public methods in non-public classes
Date Sat, 03 Dec 2016 16:21:58 GMT

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

Daniel Dekany commented on FREEMARKER-40:
-----------------------------------------

But as I said, if the non-public class implements a public interface, then the methods from
that interface are callable from the template. Or at least where I have tried it, it has worked.
Do you have a example where it fails?

As of "doesn't allow you to", `Method.invoke` throws an {java.lang.IllegalAccessException}
at you if try to do that.

> ClassIntrospector should detect public methods in non-public classes
> --------------------------------------------------------------------
>
>                 Key: FREEMARKER-40
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-40
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.25-incubating
>            Reporter: Jochen Wiedmann
>            Assignee: Daniel Dekany
>            Priority: Minor
>
> In ClassIntrospector.discoverAccessibleMethods, the assumption is made, that only public
classes can have accessible methods. This is plainly wrong: For example, a private object
might be implementing an interface.
> Freemarker should detect public gettters, and treat them as accessible. At the very least,
it should inform the user about the problem. A message like
>   "Key <propertyName> was not found on an instance of ..."
> should be replaced by
>   "Key <propertyName> was not found on an instance of ..."
>   "A possible reason is,that the class must be public."
> Thanks,
> Jochen



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message