public void visitReferenceExpression(PsiReferenceExpression expression) { super.visitReferenceExpression(expression); if (isProhibitedReference(expression)) { final PsiField field = getReferencedField(expression); if (!hasGetter(field) && !isStaticFinal(field) && !field.getModifierList().hasModifierProperty(PsiModifier.PUBLIC)) { fieldsNeedingGetter.add(field); } } }
public void visitAssignmentExpression(PsiAssignmentExpression expression) { super.visitAssignmentExpression(expression); final PsiExpression lhs = expression.getLExpression(); if (isProhibitedReference(lhs)) { final PsiField field = getReferencedField(lhs); if (!hasGetter(field) && !isStaticFinal(field) && !field.getModifierList().hasModifierProperty(PsiModifier.PUBLIC)) { fieldsNeedingSetter.add(field); } } }
private boolean isStaticFinal(PsiField field) { final PsiModifierList modifierList = field.getModifierList(); logger.assertTrue(modifierList != null); return modifierList.hasModifierProperty(PsiModifier.STATIC) && modifierList.hasModifierProperty(PsiModifier.FINAL); }