RecordExhaustivenessResult (@NotNull PsiType recordType, @NotNull List<? extends PsiType> recordTypes, @NotNull Map<PsiType, BranchesExhaustiveness> notExhaustiveBranches, @NotNull Set<PsiClass> missedClasses) { RecordExhaustivenessResult result = RecordExhaustivenessResult.createNotExhaustiveResult(); for (PsiClass missedClass : missedClasses) { PsiClassType missedType = PsiTypesUtil.getClassType(missedClass); BranchesExhaustiveness branchesExhaustiveness = notExhaustiveBranches.get(missedType); if (branchesExhaustiveness == null) { //There is a chance that branchExhaustiveness cover partially this new branch, //but let's not recalculate and make it simple and fast. //Otherwise, we have to process all classes in a permit list every time result.addNewBranch(recordType, missedType, recordTypes); } else { RecordExhaustivenessResult recordExhaustivenessResult = branchesExhaustiveness.result(); recordExhaustivenessResult.addNextType(recordType, missedType); result.merge(recordExhaustivenessResult); } } return result; }