boolean (PsiExpression expression) { for (int i = 0; i < 3; i++) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (expression instanceof PsiReferenceExpression) { PsiField target = tryCast(((PsiReferenceExpression)expression).resolve(), PsiField.class); if (target != null) { if ("UTF_8".equals(target.getName())) return false; if (target.getContainingClass() != null && "java.nio.charset.StandardCharsets".equals(target.getContainingClass().getQualifiedName())) { return true; } if (target.hasModifierProperty(PsiModifier.FINAL)) { expression = target.getInitializer(); continue; } } } if (expression instanceof PsiMethodCallExpression && CHARSET_FOR_NAME.test((PsiMethodCallExpression)expression)) { PsiExpression arg = ((PsiMethodCallExpression)expression).getArgumentList().getExpressions()[0]; Object value = ExpressionUtils.computeConstantExpression(arg); return value instanceof String && !((String)value).equalsIgnoreCase("utf-8"); } break; } return false; }