PrivateAccessor methods fail with Class as first parameter
Brought to you by:
vbossica
PrivateAccessor
methods using Class
as the first parameter (as opposed to Object
) fail. The issue is the reflection call:
return field.get(base);
field.set(base, value);
method.invoke(base, args);
Every instance of base
in the previous calls should be replaced with the call base.newInstance()
.
Well, my mistake here. I didn't realize that the
Class
-parametered methods were meant to be used withstatic
members only. It's only apparent in the exception. Please add this detail to the docs.