Since, MethodUtils is not going to be in the same package as whatever class you are calling a method on, I don't think you going to be allowed to call a package, protected or private methods in that class?

   --Will

Henri Yandell wrote:
JIRA reports are good - we've a big backlog in BeanUtils but it's
starting to go down.

There are a couple of other similar issues (BEANUTILS-157 + BEANUTILS-87).

I don't know why the API is designed to only work with public methods;
whether that's an aspect of adherence to the spec, by design or
legacy. Seems that if we're going to use setAccessible, that we could
just open it to package and private too.

Anyone know why MethodUtils intentionally limits itself?

Hen

On 11/22/06, Tom Schindl <[EMAIL PROTECTED]> wrote:
Hi,

Nobody any comments should I file a bug report against JIRA?

Tom

Tom Schindl schrieb:
> Hi,
>
> I have an issue the current implementation of
>
> MethodUtils#getAccessibleMethod(Method) where it reads:
>
> ------------8<------------
> if( Modifier.isPublic(clazz.getModifiers()) ) {
>
> }
>
> // Check the implemented interfaces and subinterfaces
> ------------8<------------
>
> With this check setting attributes on a class Hierarchy like the one
> below doesn't work:
>
> ------------8<------------
> class HiddenBean {
>       private String a;
>
>       protected HiddenBean() {
>
>       }
>
>       public void setA(String a) {
>               this.a = a;
>       }
>
>       public String getA() {
>               return this.a;
>       }
> }
>
> public class PublicBean extends HiddenBean {
>
> }
> ------------8<------------
>
> The problem is that big framework like e.g. Eclipse often use
> package-visible classes to not expose too much API to the user and you
> can't use BeanUtils currently to set values.
>
> I came across this problem when trying to provide an enhanced version of > XSWT which is not working in Eclipse 3.2 but not in 3.3 any more because
> of this.
>
> What would be the problem to change the check to the following:
>
> MethodUtils#getAccessibleMethod(Method):
> ------------8<------------
> if( ! Modifier.isPrivate(clazz.getModifiers()) && !
> Modifier.isPackage(clazz.getModifiers()) ) {
>
> }
> ------------8<------------
>
> PropertyUtilsBean#invokeMethod(...):
> ------------8<------------
> method.setAccessible(true);
> return method.invoke(bean,values);
> ------------8<------------
>
> I first wanted to discuss this here and not creating an bug immediately.
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to