Sorry, my example was indeed not sufficient. You don’t need the complete class though. And no, I’m not suggesting to evaluate the name.
public class C
{
private static long nextID = 1L;
private final long localID = nextID++; // FP
public int getID()
{
return localID;
}
}
So, the rule would just need to look at the whole class, and if the field is used in a non static context.