Set<Task> (@NotNull Project project, @NotNull ModelBuilderContext context) { try { GradleResultUtil.runOrRetryOnce(() -> { if (TASKS_REFRESH_REQUIRED) { refreshProjectTasks(project); } }); return GradleResultUtil.runOrRetryOnce(() -> { return new TreeSet<>(project.getTasks()); }); } catch (Exception exception) { context.getMessageReporter().createMessage() .withGroup(Messages.TASK_MODEL_COLLECTING_GROUP) .withTitle("Tasks collecting failure") .withText("Tasks for " + project + " cannot be collected due to plugin exception.") .withException(exception) .withKind(Message.Kind.WARNING) .reportMessage(project); return Collections.emptySet(); } }