varargs and null argument

Viewed 8193

So, I have a weird issue. This expression: method.invoke(target, null) throws java.lang.IllegalArgumentException: wrong number of arguments

The problem is that this expression is deep inside hibernate (BasicPropertyAccessor$BasicGetter to be precise) and I guess it should work fine (it did until recently)

I debugged this problem in eclipse and indeed, if I (in Display view) call method.invoke(target) or method.invoke(target, (Object[]) null) everything works fine. I'm sure my class has this getter and it has no arguments. So ... the question is, what the hell is going on?!

EDIT:

  • method is an instance of java.lang.reflect.Method and points to the said getter
  • target is an instance of the class with public X getX() getter
  • JDK 1.6.0_31
  • code in hibernate (BasicPropertyAccessor:143) :

    public Object get(Object target) throws HibernateException {
        try {
            return method.invoke(target, null);
        }
        catch{ ... }
    }
    
2 Answers
Related