The documentation says that if your class is java.lang.Object
, then its getSuperclass
is going to return null
. In other words, if you do this
Class objSuper = Object.class.getSuperclass();
then objSuper
would be null
; this is precisely what's happening (demo).
It appears, however, that your modelClass
is not java.lang.Object
, and it is also not a primitive or an interface. Therefore, returning java.lang.Object
makes perfect sense, because all classes implicitly inherit from it.