I\'m making a MethodPointer class in order to simulate the functionality of function pointers from C++. At first, I was doing everything with just Object
The problem is that getClass() ignores type parameters.
The Javadocs say:
The actual result type is
Class extends |X|>where|X|is the erasure of the static type of the expression on which getClass is called.
For example, new ArrayList returns a Class extends ArrayList>, not Class extends ArrayList.
This also means that getClass() called on a type parameter decays to a Class extends Object>.