void () { if (checkedForDuplicates) { return; } checkedForDuplicates = true; Map<String, List<IntentionAction>> map = new HashMap<>(myActions.size()); for (IntentionAction action : myActions) { map.computeIfAbsent(action instanceof IntentionActionDelegate ? ((IntentionActionDelegate)action).getImplementationClassName() : action.getClass().getName(), k -> new SmartList<>()).add(action); } List<String> duplicates = new ArrayList<>(); for (List<IntentionAction> list : map.values()) { if (list.size() > 1) { String duplicateDescriptions = StringUtil.join(list, a -> { Class<?> fixClass = IntentionActionDelegate.unwrap(a).getClass(); return "Registered: " + fixClass + " from plugin " + PluginManager.getPluginByClass(fixClass); }, "\n"); duplicates.add( list.size() + " intention duplicates found for " + IntentionActionDelegate.unwrap(list.get(0)) + ":\n" + duplicateDescriptions); } } if (!duplicates.isEmpty()) { throw new IllegalStateException(duplicates.toString()); } }