lundi 19 mars 2018

java.lang.reflect.Field returns null for non null name

We are migrating one of our applications from java 6 to java 8 and there are a few unit tests no longer passing. When fixing one of those I came acoss with the situation below:

I have a class MyClass extending MySuperClass which in turn has a protected field called retryCount and when calling MyClass.class.getDeclaredField("retryCount") it throws a NoSuchFieldException which looks very strange to me.

I started digging down in the java code and when debugging Field class I found this which I could not explain. Note that this is the same in java 6 it is the test change that brought me to this.

Java debug

Can you please help me understand what is going on? Thank you in advance.





Aucun commentaire:

Enregistrer un commentaire