void (GrCodeBlock body) { final GrStatement[] statements = body.getStatements(); for (final GrStatement statement : statements) { if (isConditional(statement)) { return; } if (!(statement instanceof GrMethodCallExpression methodCallExpression)) { continue; } final GrExpression methodExpression = methodCallExpression.getInvokedExpression(); if (!(methodExpression instanceof GrReferenceExpression reference)) { return; } final String name = reference.getReferenceName(); if (!"wait".equals(name)) { return; } final PsiMethod method = methodCallExpression.resolveMethod(); if (method == null) { return; } final PsiClass containingClass = method.getContainingClass(); if (containingClass == null || !CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) { return; } registerMethodCallError(methodCallExpression); } }