void (@NotNull PsiWhileStatement statement) { super.visitWhileStatement(statement); final PsiStatement body = statement.getBody(); boolean empty = ControlFlowUtils.statementIsEmpty(body); if (ignoreNonEmtpyLoops && !empty) { PsiExpressionStatement onlyExpr = ObjectUtils.tryCast(ControlFlowUtils.stripBraces(body), PsiExpressionStatement.class); if (onlyExpr == null || !THREAD_ON_SPIN_WAIT.matches(onlyExpr.getExpression())) return; } final PsiExpression condition = statement.getCondition(); final PsiField field = getFieldIfSimpleFieldComparison(condition); if (field == null) return; if (body != null && (VariableAccessUtils.variableIsAssigned(field, body) || containsCall(body, ThreadingUtils::isWaitCall))) { return; } boolean java9 = PsiUtil.isLanguageLevel9OrHigher(field); boolean shouldAddSpinWait = java9 && empty && !containsCall(body, THREAD_ON_SPIN_WAIT); if (field.hasModifierProperty(PsiModifier.VOLATILE) && !shouldAddSpinWait) { return; } registerStatementError(statement, field, shouldAddSpinWait); }