Snippet to reproduce:
package test;
public class SomeClass {
public static Class<?> cl = SomeClass.class;
private String unusedField;
}
For unusedField, nothing is reported. After commenting out public static Class<?> cl = SomeClass.class;, a bug is reported as expected.
Seems to be coming from: 9ae2687
In particular as soon as LDC Ltest/SomeClass;.class is seen, SomeClass is assumed to be accessed with reflection and the change above suppresses the unused field bug report.
Snippet to reproduce:
For
unusedField, nothing is reported. After commenting outpublic static Class<?> cl = SomeClass.class;, a bug is reported as expected.Seems to be coming from: 9ae2687
In particular as soon as
LDC Ltest/SomeClass;.classis seen,SomeClassis assumed to be accessed with reflection and the change above suppresses the unused field bug report.