NlsInfo (@NotNull UExpression expression, boolean allowStringModifications) { UElement parent = UastUtils.skipParenthesizedExprUp(expression.getUastParent()); if (parent instanceof UCallExpression) { String name = ((UCallExpression)parent).getMethodName(); if (name != null && (name.equals("equals") || (allowStringModifications && name.equals("startsWith") || name.equals("endsWith") || name.equals("equalsIgnoreCase") || name.equals("contains")))) { var qualifiedCall = ObjectUtils.tryCast(parent.getUastParent(), UQualifiedReferenceExpression.class); if (qualifiedCall != null && parent.equals(qualifiedCall.getSelector())) { return fromVariableReference(qualifiedCall.getReceiver()); } } } if (parent instanceof UBinaryExpression) { UastBinaryOperator operator = ((UBinaryExpression)parent).getOperator(); if (operator == UastBinaryOperator.EQUALS || operator == UastBinaryOperator.NOT_EQUALS) { UExpression left = ((UBinaryExpression)parent).getLeftOperand(); UExpression right = ((UBinaryExpression)parent).getRightOperand(); if (AnnotationContext.expressionsAreEquivalent(left, expression)) { return fromVariableReference(right); } if (AnnotationContext.expressionsAreEquivalent(right, expression)) { return fromVariableReference(left); } } } return NlsUnspecified.UNKNOWN; }