void (@NotNull PsiDeconstructionPattern deconstructionPattern) { super.visitDeconstructionPattern(deconstructionPattern); add(PatternHighlightingModel.checkReferenceTypeIsNotAnnotated(deconstructionPattern.getTypeElement())); PsiElement parent = deconstructionPattern.getParent(); if (parent instanceof PsiForeachPatternStatement forEach) { add(checkFeature(deconstructionPattern, HighlightingFeature.RECORD_PATTERNS_IN_FOR_EACH)); if (hasErrorResults()) return; PsiTypeElement typeElement = JavaPsiPatternUtil.getPatternTypeElement(deconstructionPattern); if (typeElement == null) return; PsiType patternType = typeElement.getType(); PsiExpression iteratedValue = forEach.getIteratedValue(); PsiType itemType = iteratedValue == null ? null : JavaGenericsUtil.getCollectionItemType(iteratedValue); if (itemType == null) return; PatternHighlightingModel.checkForEachPatternApplicable(deconstructionPattern, patternType, itemType, myErrorSink); if (hasErrorResults()) return; PsiClass selectorClass = PsiUtil.resolveClassInClassTypeOnly(TypeConversionUtil.erasure(itemType)); if (selectorClass != null && (selectorClass.hasModifierProperty(SEALED) || selectorClass.isRecord())) { if (!PatternHighlightingModel.checkRecordExhaustiveness(Collections.singletonList(deconstructionPattern), patternType, forEach) .isExhaustive()) { add(PatternHighlightingModel.createPatternIsNotExhaustiveError(deconstructionPattern, patternType, itemType)); } } else { add(PatternHighlightingModel.createPatternIsNotExhaustiveError(deconstructionPattern, patternType, itemType)); } } else { add(checkFeature(deconstructionPattern, HighlightingFeature.PATTERN_GUARDS_AND_RECORD_PATTERNS)); } }