I have got this warning: non-varargs call of varargs method with inexact argument type for last parameter;

Well, the compiler warning tells you everything you need to know. It doesn't know whether to treat null as a Class<?>[] to pass directly into getMethod, or as a single null entry in a new Class<?>[] array. I suspect you want the former behaviour, so cast the null to Class<?>[]:

Method method = aClass.getMethod("getInstance", (Class<?>[]) null);

If you wanted it to create a Class<?>[] with a single null element, you'd cast it to Class<?>:

Method method = aClass.getMethod("getInstance", (Class<?>) null);

Alternatively you could remove the argument altogether, and let the compiler build an empty array:

Method method = aClass.getMethod("getInstance");