public void fieldModifiersCheck(VariableDeclaration vd) {
TypeDeclaration td = vd.upUpToTypeDeclaration();
if (td == null) return; //not a field.
VariableDefinition def = vd.astDefinition();
if (def != null) {
Modifiers m = def.astModifiers();
modifiersCheck(m, FIELD_MODIFIERS_EXCLUSIVITY, FIELD_MODIFIERS_LEGAL, "field declarations");
boolean allFieldsHaveInitializers = true;
for (VariableDefinitionEntry entry : def.astVariables()) {
if (entry.rawInitializer() == null) {
allFieldsHaveInitializers = false;
break;
}
}
if (m.isStatic() && !m.isFinal() && !allFieldsHaveInitializers) {
// Initialized static final fields, assuming the initializer expression is a compile time constant, are 'special' and
// do not need to adhere to the static chain rule. However, we can't determine CTC nature without resolution.
checkStaticChain(m);
}
}