void (@NotNull PsiThisExpression expression) { super.visitThisExpression(expression); if (!isInInitializer(expression)) { return; } final PsiJavaCodeReferenceElement qualifier = expression.getQualifier(); final PsiClass containingClass = ClassUtils.getContainingClass(expression); if (qualifier != null) { final PsiElement element = qualifier.resolve(); if (!(element instanceof PsiClass aClass)) { return; } if (!aClass.equals(containingClass)) { return; } } final PsiElement parent = expression.getParent(); if (parent instanceof PsiAssignmentExpression assignmentExpression) { if (!thisEscapesToField(expression, assignmentExpression)) { return; } registerError(expression); } else if (parent instanceof PsiExpressionList) { final PsiElement grandParent = parent.getParent(); if (grandParent instanceof PsiNewExpression newExpression) { if (!thisEscapesToConstructor(expression, newExpression)) { return; } registerError(expression); } else if (grandParent instanceof PsiMethodCallExpression methodCallExpression) { if (!thisEscapesToMethod(expression, methodCallExpression)) { return; } registerError(expression); } } }