Grant Henke
Grant Henke
This isn't intended to be committed, but just to illustrate the issue.
Digging in a little, adding `assert` prevents `unwrittenField` from being added to `declaredFields` [here](https://github.com/spotbugs/spotbugs/blob/master/spotbugs/src/main/java/edu/umd/cs/findbugs/detect/UnreadFields.java#L868) because `xFactory.isReflectiveClass(classDescriptor)` is `true`. The same thing happens when `LoggerFactory.getLogger(UnreportedUnwrittenField.class);` is used.
It looks like it is marked as a reflective class [here](https://github.com/spotbugs/spotbugs/blob/master/spotbugs/src/main/java/edu/umd/cs/findbugs/detect/ReflectiveClasses.java#L53) because of an LDC (18) op code in the case of `assert` and `LoggerFactory.getLogger(UnreportedUnwrittenField.class);`. FWIW the test passes after...
In case it's helpful this behavior was introduced in this commit: https://github.com/spotbugs/spotbugs/commit/9ae2687e771dbd927e11b6a19ad23de3419fe7c8#diff-bfcd2c82604fc6cb72facf4b143d8394