void (@NotNull PsiReferenceExpression expression) { super.visitReferenceExpression(expression); if (expression.getQualifierExpression() != null) { return; } final PsiType type = expression.getType(); if (SerializationUtils.isProbablySerializable(type)) { return; } final PsiElement target = expression.resolve(); if (!(target instanceof PsiLocalVariable) && !(target instanceof PsiParameter)) { return; } final PsiVariable variable = (PsiVariable)target; if (!variable.hasModifierProperty(PsiModifier.FINAL)) { if (!PsiUtil.isLanguageLevel8OrHigher(variable) || !HighlightControlFlowUtil.isEffectivelyFinal(variable, myClassOrLambda, expression)) { // don't warn on uncompilable code. return; } } if (PsiTreeUtil.isAncestor(myClassOrLambda, variable, true)) { return; } registerError(expression, myClassOrLambda, type); }