[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Installing instance of wrong class gives weird error

alesj do-not-reply at jboss.com
Wed Jun 11 10:12:18 EDT 2008


"wolfc" wrote : It should then check whether the declaring class is assignable from the target class.
I'll add this check to ReflectionUtils:

  |    protected static void checkMember(Object target, Member member, String memberType) throws Throwable
  |    {
  |       if (member == null)
  |          throw new IllegalArgumentException("Null " + memberType);
  | 
  |       if (target != null)
  |       {
  |          Class<?> declaringClass = member.getDeclaringClass();
  |          if (declaringClass.isInstance(target) == false)
  |             throw new IllegalArgumentException("Target (" + Strings.defaultToString(target) + ") doesn't match " + memberType + " 's (" + member + ") declaring class.");
  |       }
  | 
  |    }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157372#4157372

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157372



More information about the jboss-dev-forums mailing list