HighlightInfoType (@NotNull PsiVariable var, @NotNull PsiElement elementToHighlight) { if (var instanceof PsiLocalVariable || var instanceof PsiParameter && ((PsiParameter)var).getDeclarationScope() instanceof PsiForeachStatement) { return JavaHighlightInfoTypes.LOCAL_VARIABLE; } if (var instanceof PsiField) { if (var.hasModifierProperty(PsiModifier.STATIC)) { boolean staticallyImported = isStaticallyImported(elementToHighlight); if (var.hasModifierProperty(PsiModifier.FINAL)) { return staticallyImported ? JavaHighlightInfoTypes.STATIC_FINAL_FIELD_IMPORTED : JavaHighlightInfoTypes.STATIC_FINAL_FIELD; } else { return staticallyImported ? JavaHighlightInfoTypes.STATIC_FIELD_IMPORTED : JavaHighlightInfoTypes.STATIC_FIELD; } } else { return var.hasModifierProperty(PsiModifier.FINAL) ? JavaHighlightInfoTypes.INSTANCE_FINAL_FIELD : JavaHighlightInfoTypes.INSTANCE_FIELD; } } if (var instanceof PsiParameter) { return ((PsiParameter)var).getDeclarationScope() instanceof PsiLambdaExpression ? JavaHighlightInfoTypes.LAMBDA_PARAMETER : JavaHighlightInfoTypes.PARAMETER; } return null; }