void (@NotNull PsiClass aClass) { PsiField[] fields = aClass.getFields(); if (aClass.isEnum()) { return; } for (PsiField field : fields) { if (!field.hasModifierProperty(PsiModifier.STATIC) || field.getInitializer() != null) { continue; } if (m_ignorePrimitives) { final PsiType type = field.getType(); if (ClassUtils.isPrimitive(type)) { continue; } } final UninitializedReadCollector uninitializedReadCollector = new UninitializedReadCollector(); boolean assignedInInitializer = Arrays.stream(aClass.getInitializers()) .filter(initializer -> initializer.hasModifierProperty(PsiModifier.STATIC)) .map(PsiClassInitializer::getBody) .anyMatch(body -> uninitializedReadCollector.blockAssignsVariable(body, field)); if (assignedInInitializer) { final PsiExpression[] badReads = uninitializedReadCollector.getUninitializedReads(); for (PsiExpression badRead : badReads) { registerError(badRead); } continue; } final PsiMethod[] methods = aClass.getMethods(); for (PsiMethod method : methods) { if (!method.hasModifierProperty(PsiModifier.STATIC) || !method.isPhysical() /* EA-263167 */) { continue; } final PsiCodeBlock body = method.getBody(); uninitializedReadCollector.blockAssignsVariable(body, field); } final PsiExpression[] moreBadReads = uninitializedReadCollector.getUninitializedReads(); for (PsiExpression badRead : moreBadReads) { registerError(badRead); } } }