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]

Reply via email to