PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitReturnStatement(@NotNull PsiReturnStatement returnStatement) { super.visitReturnStatement(returnStatement); final ReturnContext context = createReturnContext(returnStatement); if (context != null && isApplicable(context)) { registerProblem(holder, returnStatement, context.returnedVariable); } } }; }