lundi 30 juillet 2018

Access and modify a protected field

I'm recently working on a project and I need to access a protected variable in another class. This is the code that I used: FieldUtils.writeField(world.getClass(), "chunkProvider", provider, true); ,but when I try to run my code I get this error: https://hastebin.com/hoqeralasa.md . As you can easily understand the error is telling me that the field is not there but if I check the target class, I can see it: protected IChunkProvider chunkProvider; What am I doing wrong?

PS: The FieldUtils class comes from org.apache.commons.lang.reflect.FieldUtils;





Aucun commentaire:

Enregistrer un commentaire